Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Calling setCanEdit after form has been drawn?

    I am trying to call a method to change an Item to/from read only status based upon data in the record being loaded in the Form. I have the following method to mark say a TextItem as ready only:

    Code:
        public void markReadOnly() {
            setCanEdit(Boolean.FALSE);
            setCanFocus(Boolean.FALSE);
            setTextBoxStyle(TEXT_ITEM_READ_ONLY_STYLE);
        }
    When i call that method I get the following warnings:

    Code:
    08:47:50.130:XRP1:WARN:configProperties:FormItem.setCanEdit(): unable to apply the Boolean argument to the FormItem instance because the instance was previously used to configure the properties of another Object
    08:47:50.130:XRP1:WARN:configProperties:FormItem.setCanFocus(): unable to apply the Boolean argument to the FormItem instance because the instance was previously used to configure the properties of another Object
    08:47:50.130:XRP1:WARN:configProperties:SelectItem.setTextBoxStyle(): unable to apply the String argument to the SelectItem instance because the instance was previously used to configure the properties of another Object
    It works but the warnings lead me to believe I am not doing this correctly. Any suggestions/advice?

    Using: SmartClient Version: v10.1p_2017-03-11/Pro Deployment (built 2017-03-11)

  • #2
    I have figured out the source of my problem. It was not with the TextItem but with a DateItem as I was trying to set the property of each component in the DateItem which then caused the warnings:

    Here is the code from my subclassed DateItem
    Code:
        public void markReadOnly() {
            setCanEdit(Boolean.FALSE);
            setCanFocus(Boolean.FALSE);
    
            markSelectItemReadOnly(getYearSelector());
            markSelectItemReadOnly(getMonthSelector());
            markSelectItemReadOnly(getDaySelector());
    }
    
        private static void markSelectItemReadOnly(SelectItem si) {
            if (si == null) return;
            si.setTextBoxStyle(SELECT_ITEM_TEXT_READ_ONLY_STYLE);
        }
    If I try to apply the text box style to the DateItem itself, it does not propagate to each of the the selector pieces.

    Any suggestions on how I should be doing this?

    Comment


    • #3
      Have you seen the doc for DynamicForm/FormItem.readOnlyDisplay?

      Comment


      • #4
        And see readOnlyTextBoxStyle for your styling here...

        Comment

        Working...
        X