ConnectEditNotify

>>-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.

Arguments:

The arguments are:

id

The ID of the edit control of which a notification is to be connected to a method.

event

The event to be connected with a method:

CHANGE

The text has been altered. This notification is sent after the screen has been updated.

UPDATE

The text has been altered. This notification is sent before the screen is updated.

ERRSPACE

An out-of-memory problem has occurred.

MAXTEXT

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.

HSCROLL

The horizontal scroll bar has been used.

VSCROLL

The vertical scroll bar has been used.

GOTFOCUS

The edit control got the input focus.

LOSTFOCUS

The edit control lost the input focus.

msgToRaise

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.

Return value:

The return codes are:

0

No error detected.

-1

The resource ID could not be resolved or the event argument is incorrect.

1

The message was not connected correctly.

Example:

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

  1. Connections are usually placed in the Init or InitDialog method. If both methods are defined, use init as the place for this connection - but not before init:super has been called.

  2. 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 = BinaryAnd(ev_id, "0x0000FFFF")
      ...