Using the MyApp CustomComboBox Control
Eric Hartwell - January 2000
The MyApp CustomComboBox control is used to specify the value
Intimate ties to the data dictionary:
Used as a control in HTML screens and/or the MyApp grid control.
In the DOS version, each field had direct access to the data dictionary and current rule's variables through global pointers. While MyApp normally runs in a single process space, so global pointers are theoretically available, it's not difficult to use a more generic approach where the plan pointer is explicitly passed to the control, and the control manages its data as a simple text string.
MyAppField ActiveX Control
At this point, let's review an earlier, simpler control, the MyAppField control. Originally called HTMLHelper, MyAppField is a hidden ActiveX control that is embedded in each MyApp HTML screen. While it does not directly display any data, MyAppField is responsible for formatting the value of each field, interpreting the results, and collecting any changes and/or errors on the screen.
DHTML scripting code within the page triggers MyAppField methods when the screen is first loaded, and whenever the value of an input field is changed. External code in the screen's container (i.e. MyAppHtmlView) explicitly calls the CMyAppField::GetChanges method before navigating away from the screen (see Issuing Commands to the HTML View).
MyAppField is packaged as an ActiveX control so it can be used by remote clients in an Internet/Intranet application.
The CustomComboBox is used only by MyApp, which is a stand-alone application. Since the document/view architecture has direct access to the HTML Document Object Model (DOM) (see Using the MyApp HTML View Automation Classes), there's no need to jump through the same hoops as with MyAppField.
At the same time, since MyApp fields are intimately tied to the data dictionary and rule specifications, it makes sense to use the control as a visual control on the screen.
The CustomComboBox control is derived from the Enhanced Flat ComboBox Control.
Dynamic Dropdown List
Sometimes the contents of the dropdown list aren't known until runtime, or the list is simply too big to be preloaded. In either case, the solution is to subclass the dropdown list and replace it with your own window.