Both forms and reports inherit from hk_presentation. The most import function of hk_presentation is set_mode(mode). The two possible modes are hk_presentation.designmode and hk_presentation.viewmode
If you want to get a reference to a specific object in a form you have two possibilities
hk_visible* get_visible(unique_number)
hk_visible* get_visible(const hk_string& identifier)
![]() | To find this number, click on the object. In the caption of the property editor you can see the number in brackets. |
Both functions return a reference of type hk_visible. To change it to the type you need there are some type casting functions
Figure 3-7. Type casting
hk_button *cast_button(hk_visible*);
hk_dslineedit *cast_dslineedit(hk_visible*);
hk_dsmemo *cast_dsmemo(hk_visible*);
hk_dsgrid *cast_dsgrid(hk_visible*);
hk_dscombobox *cast_dscombobox(hk_visible*);
hk_dsboolean *cast_dsboolean(hk_visible*);
hk_dsvisible *cast_dsvisible(hk_visible*);
hk_form *cast_form(hk_visible*);
hk_report *cast_report(hk_visible*);
The next program shows you how to start a form:
Here is how to start a report:
Example 3-10. displaying a report
1 myreport=hk_this.datasource().database().new_reportvisible() 2 myreport.load_report("complexreport") 3 myreport.set_mode(myreport.viewmode) 4 |
A visible object in a report is of type hk_reportdata, which inherits from hk_dsdatavisible. The main methods are
set_data(const hk_string& d)
hk_string data(void)
The following example shows how to print numbers in different colours. For this we use the "onprint" action