A developer recently asked on the Works forum if it was possible to use the table browser from within a program. Well the simple answer is "Yes". The slightly more complex answer is that since so many of the OI tools are now written in OI itself it is frequently possible to use these tools from within programs.
The first thing we need to know is what the table browser window is called. It may come as a surprise to those more familiar with obscure naming conventions to find out that it is called "TABLE_BROWSER". So to call it programmatically we'd simply
atWindow = Start_Window("TABLE_BROWSER", @Window)
Of course launching it might not be enough - we might also want to populate it with the contents of a table. To do this we need to know the control names. To save you the investigative work we've included a table below :-
TABLE_BROWSER |
The window |
TABLE_BROWSER.BTN_CANCEL |
The cancel button |
TABLE_BROWSER.BTN_LOAD |
The load button |
TABLE_BROWSER.BTN_OK |
The Ok button |
TABLE_BROWSER.BTN_OPTIONS |
The options button |
TABLE_BROWSER.DATA_TABLE |
The results edit table |
TABLE_BROWSER.NUM_RECORDS |
The number of records to display |
TABLE_BROWSER.SELECTION_BTN |
The selection button |
TABLE_BROWSER.TABLENAME |
The table name edit field |
TABLE_BROWSER.TEXT_1 |
The Tablename static |
TABLE_BROWSER.TEXT_2 |
The Number of Records static |
So to launch the browser and load the AVERY_LABELS table we could
Declare Function set_Property, start_Window
atWindow = Start_Window("TABLE_BROWSER", @Window)
objxArray = atWindow : ".TABLENAME"
propArray = "DEFPROP"
dataArray = "AVERY_LABELS"
dataArray = set_Property( objxArray, propArray, dataArray )
Call send_Event(atWindow : ".BTN_LOAD", "CLICK")
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home