Page 1 of 1

How can I automatically submit a subfile option on click?

Posted: Thu Jul 24, 2008 5:46 am
by Profound Logic
Q:
How can I automatically submit a subfile option when the user clicks on a subfile detail row?

A:
Genie provides a subfile row onclick property that can be found in the Events section of the design properties window for the main screen. Genie also provides functions that can be used to put a value into an input field, and to press keys for the user.

For example, the following code can be used in the subfile row onclick event to place an option 5 in the subfile option field for a row when the user clicks on it:

Code: Select all

changeElementValue("I_" + hiLine + "_2", "5"); pressKey("Enter");
The changeElementValue function takes two parameters. The first parameter is the field identifier to work with. Genie assigns a unique field identifier (based on the fields row and column) to each field on the display. You can view these field identifiers by clicking on a field in the designer. Its id will appear in the title bar of the design properties window. In this example, the subfile option field id is being calculated dynamically by using a special variable in Genie called hiLine. This variable contains the currently active subfile detail row number. In this example, the subfile option field is in column 2. The second parameter is the value to place into the option field, 5 in this case. The pressKey function is then used to press the enter key on the screen.