This object is similar to the TTASEnter with a few extra options. You can create a list of values that the user can choose from if the click on the drop down button or as they are typing.
PALETTE ICON & EXAMPLE
PROPERTIES
The following are the properties that apply to this object. Some are defined in Common Properties and are linked to their appropriate page.
Appearance
Behavior
Font
Hint
List
ItemHeight | The size of each line in the drop down box in pixels. This can be modified during runtime. |
Items | The line items in the drop down box. You can modify this list during runtime by using the COMBO_ITEM command or the STRINGS() function. |
Misc
Other
CharCase | Use this property to determine what case the characters will be entered in. To force upper case use ecUpperCase, to force lower case use ecLowerCase and to allow either use ecNormal. The default value is ecNormal. This property can be modified during runtime. The values are defined in COMPILERCONSTANTS.TXT. |
DropDownCount | How many line items appear to the user at a time. If there are more items than this a vertical scroll bar will be displayed for the user to scroll down or up in the list of items. |
ItemNumber | If the user chooses an item from the Item property list this will be the item number value. |
MaxLength | The maximum number of characters the user can enter for this object. If you have connected this to a field in your program with the FieldName property then this will be set automatically when the program runs to the size of the field. |
SelectStart | This property allows you to set the location of the cursor within the text window. The primary purpose of this property is to reset the text line within the object window. If the user exits the object and the text line is longer than the window and the beginning of the text line is hidden, you can force the text line to redisplay from the beginning by setting this property to 0. |
Sorted | If this is checked (set to .True.) then the items in the Items list will be sorted. This can be modified during runtime. |
Style | What type of combo box to display. The options are: csDropDown (allow the user to either enter a value directly into the field or choose a value from the drop down box - default value), csDropDownList (user may only choose a value from the drop down list, not allowed to enter directly into the field), csSimple (no drop down box is available, however, the user can scroll through the available items using the up and down arrows). The options csOwnerDrawFixed and csOwnerDrawVariable are not available at this time. |
NOTE: The csDropDownList option will make sure that the user will always choose one of the values in the Items property. To have the value display properly in the object display window you must make sure that the value in the field matches exactly one of the values in the ITEMS list (above). Something to watch out for are extra spaces at the end of the value in the ITEMS list. The program will not be able to match the value in the field to the value in the list if there are extra spaces appended to the items in the list.
Text | This is the actual data that has been entered by the user or that comes from the field value if this is attached to a field in your program. The value can be accessed during runtime and is automatically updated if you have set the FieldName property value. The property value will also be saved automatically to the field when the user moves to the next object. |
Position
TAS Pro
DfltValue | This value will be inserted automatically into the field if the field is blank when the object is chosen on the form. If you want to use a constant value surround the value in quotes, e.g., 'ABC' or '100.50' etc. If you want to use a field, then just put in the field name. The default value is blank. This can be changed during runtime. |
NOTE: You can't use an expression here. However, this is a perfect use of the VALUE option in the DEFINE field command. Just define a field, set the VALUE option to what ever expression you want to use, and put that field name into the DfltValue property.
DropDown | Set this property to True if you want to force the drop down box to be displayed. This will also set the focus to this object. To close the drop down box set this property to False. |
NOTE: This is a runtime only property and will not show up in the Object Inspector.
FldModified | NOTE: This is a runtime only property and will not show up in the Object Inspector. |
EVENTS
This object has events that are called depending on what the user does. The events are routines in your program that may return a value (generally .True. or .False.) or just alert your program that something is happening. An event looks to your program for a special label. It is made up of the object Name, a period (.) and the Event name (listed below). For example, the Change event below would be: ObjectName.Change:
Change | This event is called every time the user makes a change to the Text of this object. That includes entering a new character, deleting a character, etc. Each time this event is executed the field that is attached to this object through the FieldName property is updated so that you can check the characters entered, modified, etc. through the field. Be cautious about using this since it will slow down the entry process. |
Disp | This event is called when the field that is attached to the object is to be refreshed on the screen. This can happen when a record is read, after a calculation, etc. |
DropDown This event is called when the user clicks on the drop down button and before the list is displayed. This gives you the ability to load the list when needed.
Post | This event is called when the user moves from the current object to another. By default this event will return .True. If you return .False. This will keep the user from leaving this object. This will stop the process from continuing, This can be used to make sure settings are proper after leaving the object. To force the user to stay on the current object, if there is a problem, you may also use the Valid event instead of this. |
Pre | This event is called when the user moves into an object. If you use this event you must return .True. or .False. when you return (RET) from the routine. If you return .True. the user is allowed to access the object. If you return .False. the object that was active before they got to this object will get the focus again. This keeps the user from accessing an object that you don't want to be active. Commonly used in application where some fields are accessible sometimes (RET .TRUE.) and aren't others (RET .FALSE.). |
The process by which these events are called is:
Pre - This occurs when focus changes to the object.
Change - During field entry.
Post - Called after Valid returns .True. (if there is a Valid event) and before the Pre for the next object.
Disp - Is called anytime the form/object is refreshed.
DropDown - Is called when the user clicks on the drop down button.
Example
The example below shows code on how to read data into the combo box using a scan and the combo_item command.
umcomp.pre: //load the dropdown
COMBO_ITEM CLR NAME 'umcomp' clear
SCAN @um_hndl KEY UM.TYPE START MAT.UM.TYPE WHILE UM.TYPE = MAT.UM.TYPE
COMBO_ITEM ADD UM.NAME NAME 'umcomp'
ends
set_object 'umcomp' property 'dropdown' value true //This forces the dropdown to dropdown it has to be after the COMBO_ITEM command
ret
Page url: http://www.cassoftware.com/tas/manual/ttascombobox.htm