>>-aMessageExtensions~ConnectEditNotify(--id--,--"--+-CHANGE----+--"--> +-UPDATE----+ +-ERRSPACE--+ +-MAXTEXT---+ +-HSCROLL---+ +-VSCROLL---+ +-GOTFOCUS--+ +-LOSTFOCUS-+ >--+---------------+--)---------------------------------------------->< +-,--msgToRaise-+
The ConnectEditNotify method connects a particular WM_NOTIFY message for an edit control with a method. The WM_NOTIFY message informs the dialog that an event has occurred with regard to the edit control.
The arguments are:
The ID of the edit control of which a notification is to be connected to a method.
The event to be connected with a method:
The text has been altered. This notification is sent after the screen has been updated.
The text has been altered. This notification is sent before the screen is updated.
An out-of-memory problem has occurred.
The text inserted exceeds the specified number of characters for the edit control. This notification is also sent when:
An edit control does not have the ES_AUTOHSCROLL or AUTOSCROLLH style and the number of characters to be inserted would exceed the width of the edit control.
The ES_AUTOVSCROLL or AUTOSCROLLV style is not set and the total number of lines resulting from a text insertion would exceed the height of the edit control.
The horizontal scroll bar has been used.
The vertical scroll bar has been used.
The edit control got the input focus.
The edit control lost the input focus.
The message that is to be sent whenever the specified notification is received from the edit control. Provide a method with a matching name. If you omit this argument, the event is preceded by On.
The return codes are:
No error detected.
The resource ID could not be resolved or the event argument is incorrect.
The message was not connected correctly.
The following example verifies the input of entry line AMOUNT and resets it to 0 when a nonnumeric value was entered:
::class MyDlgClass subclass UserDialog inherit MessageExtensions ::method Init self~init:super(...) self~ConnectEditNotify("AMOUNT", "CHANGE") ::method OnChange ec = self~GetEditControl("AMOUNT") if ec~GetText~Space(0) \= "" & ec~GetText~DataType("N") = 0 then do ec~SetModified(0) ec~Select ec~ReplaceSelText("0") end
The event-handling methods receive two arguments: the ID of the edit control (extract the low-order word) and the handle to the edit control.
Example:::method Handler use arg ev_id, handle id = .DlgUtil~loWord(ev_id) ...