Fired before the combo drop down is displayed, allowing changes to the drop down data.


CtrlIdIdentifies a subclassed control
NewTextThe current text in the editline
OldTextThe previous text in the editliine
Deleting1 if the user is deleting characters, 0 if the user is adding characters


The OnComboVirtualData event is fired right before the Subclass control displays the drop down. It's a great time to change the combo data on the fly based on what the user has typed so far. For example, you could wait until the user has type three or four characters before sending a search query to a web service.

You don't have to set any other property to cause this event to fire. It always fires. If ignored, the combo behaves normally. If you want to capture it, you must qualify this event synchronously to work.

The CtlrId parameter identifies the control who fired the event. You can use this parameter in properties and methods to make any desired modifications in response to the event.

The NewText, OldText, and Deleting parameters are useful in helping you determine the manner of change the user is making. For example, if the user is deleting characters, you probably don't want to change the contents of the drop down.


Transfer Param1 to CtrlId 
Transfer Param2 to NewText
Transfer Param3 to OldText
Transfer Param4 to Deleting

// If the user has just added a second character, lookup names starting with those two characters
If Len(NewText) EQ 2 AND Not(Deleting) then
    Convert to @UPPER.CASE in NewText
    Names = Xlate("SYSLISTS", "NAMES_":NewText, "", "X")
    If Len(Names) then
        Convert @FM to @STM in Names
        Set_Property(@Window:".OLE_SUBCLASS", "OLE.ComboData[":CtrlId:"]", Names)

// If the user has just deleted all but one character, clear the dropdown
end else if Len(NewText) LT 2 AND Deleting then
    Set_Property(@Window:".OLE_SUBCLASS", "OLE.ComboData[":CtrlId:"]", "")

See Also


  • No labels