Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Controlling Text Gadgets’ Editing

  • Last UpdatedNov 13, 2025
  • 2 minute read

Text fields have a member Editable (read/write), which controls the user's ability to edit the displayed text interactively, for example,

!this.myTextField.editable = false

Makes the field read only.

Modified Events for Text Gadgets

When the user finishes modifying the field by clicking ENTER while the field has focus, or pressing any button on the form, the field content is validated. If valid, then the field’s callback (if any) is notified (executed) of a SELECT event, and the field returns to ‘white’ again indicating that it is no longer modified. Otherwise an error is detected, the field’s background colour becomes ‘gold’ and focus is returned to it for further modification.

The setEditable method allows PML to be notified when the displayed text is modified by user interaction

setEditable( !attribute is STRING, !value is REAL )

Currently the only attribute supported is HANDLEMOIFY which may have the integer values:

  • 0 MODIFIED events off (default).

  • 1 Generate MODIFIED event at first user modification only.

    Note: MODIFIED events are not notified to PML unless the field is editable, modified events are enabled and an open callback has been specified (so that MODIFIED and SELECT events cannot be differentiated)

Typically, the first MODIFIED event is used to allow AppWare to gain control and modify the properties (for example, ACTIVE status) of dependent gadgets, which possibly the user should not have access to until the text field’s VALIDATE and SELECT events have been handled.

The code fragment below defines an RTOGGLE that allows a user specified TV program to be typed into an associated TEXT gadget.

rToggle .rad6 tagwid 7 |TV:|                     States '' 'TV'

text .TV  width 10 is STRING

!this.rad6.callback = '!this.RGroupSelectionChanged('

-- set open callback on text field and option list

!this.TV.callback = '!this.selectProgram('

!this.Radio.callback = '!this.selectProgram('

‑ handle first Modified event only

!this.TV.setModified( ‘handleModify’, 1 )

The extended (open) callback selectProgram(, shown below, intelligently handles the TEXT gadget and OPTION list. The open callback RGroupSelectionChanged sets the value of the ‘TV’ RTOGGLE from the TEXT gadget.

define method .selectProgram( !gad is GADGET, !event is STRING )

 -- Select new program from option list or text input field

 if( !gad.type( ) eq 'TEXT' ) then

  -- Control active state of R-toggle according to modified state of textfield

  !rtog = !this.rad6

  if( !event eq 'MODIFIED' ) then

   -- deactivate R-toggle

   !rtog.active = false

  elseif( !event eq 'SELECT' ) then

   -- reactivate R-toggle

   !rtog.active = true

  endif

 else

  -- select radio program from option list

  !rtog = !this.rad5

 endif

 if( !this.rg1.val eq !rtog.index ) then

  -- deselect current selection

  !this.rg1.val = 0

  !this.choice.clear()

 endif

endmethod

define method .RGroupSelectionChanged( !rtog is GADGET, !event is STRING )

 -- Service specified radio-toggle events

 if( !event eq 'UNSELECT' ) then

  -- Do some application actions

  !this.choice.clear()

 elseif( !event eq 'SELECT' ) then

  !value = !rtog.onValue

  -- Do some application actions

  if( !value eq 'radio' ) then

   !value = !this.Radio.selection('dtext')

  elseif( !value eq 'TV' ) then

   !value = !this.TV.val

  endif

  !this.choice.val = !value

 endif

endmethod

Related Links
TitleResults for “How to create a CRG?”Also Available in