Table of Contents
Before we start writing programs, we will first have some theory. Below you see the (c++)- structure of hk_classes. There are classes that handle the contact to the database (see the left side of the graphic), while others handle the interaction with the user (we have already seen the hk_visible class in the previous section).
All data-sensitive objects are of type hk_dsvisible (or its child hk_dsdatavisible). hk_dsvisible inherits from hk_visible. The most important method of hk_dsvisible is datasource(). This method returns a class of type hk_datasource, representing the whole datasource (either a table or a query)
Figure 3.3. hk_datasource methods
- name()
returns the name of the datasource
- goto_row(rownumber)
moves the row selector (row cursor) to 'rownumber'
- goto_first()
- goto_last()
- goto_next()
- goto_previous()
- row_position()
returns the row number of the current row
- max_rows()
returns the total number of existing rows
- enable()
- disable()
- set_enabled(e)
- is_enabled()
- hk_column*column_by_name(name)
returns an hk_column object of the column with the name 'name'
- store_changed_data()
- hk_database*database()
The following example shows how to move between rows in a datasource. For this, create a button in the form and set a datasource. Add the script to the "On click"-action.
How to get a specific hk_column object can be seen in the following example. For what you can do with this object, please see the next chapter.