hk_form

Hk_form represents a form.

Inherits from hk_presentation.

load_form([name])

Loads the form from a file, where 'name' is the name of the form

save_form([name[,ask]])

Saves the form to a file, where 'name' is the name of the file. if 'ask' is true and the form already exists you will be asked before the old form will be overwritten. Returns True if successful else False.

masterform()

if this is a subform it will return master form it belongs to.

new_grid()

The form has to be in design mode to use this function! The function will create a new hk_dsgrid in the upper left corner and returns it if successful.

new_lineedit()

The form has to be in design mode to use this function! The function will create a new hk_dslineedit in the upper left corner and returns it if successful.

new_bool()

The form has to be in design mode to use this function! The function will create a new hk_dsboolean in the upper left corner and returns it if successful.

new_combobox()

The form has to be in design mode to use this function! The function will create a new hk_dscombobox in the upper left corner and returns it if successful.

new_button()

The form has to be in design mode to use this function! The function will create a new hk_button in the upper left corner and returns it if successful.

new_rowselector()

The form has to be in design mode to use this function! The function will create a new hk_dsrowselector in the upper left corner and returns it if successful.

new_memo()

The form has to be in design mode to use this function! The function will create a new hk_dsmemo in the upper left corner and returns it if successful.

new_label()

The form has to be in design mode to use this function! The function will create a new hk_label in the upper left corner and returns it if successful.

set_designsize(width,height[,registerchange])

Sets the real size of the form. If you designed a form in i.e. 800x600 resolution and want to watch it with 1024x768 resolution, set this to 1024x768. Dynamic sized visible objects will be resized. All objects will be positioned new.

get_visible(number)

returns an existing visible object of type hk_visible identified by a unique identifier number. You should use get_pyvisible instead, so typecasting is not required any more.

Important

To find this number, click on the object. In the property editor you can see the number in field 'Id'.

To change the hk_visible object to the type you need there are some type casting functions

Figure 2.9. Type casting

get_visible(name)

returns an existing visible object of type hk_visible identified by a unique text identifier. This is a user-defined unique identifier and can be set in the property editor.You should use get_pyvisible instead, so typecasting is not required any more.

get_pyvisible(number)

returns an existing visible object identified by a unique identifier number. There is no need for typecasting.

Important

To find this number, click on the object. In the property editor you can see the number in field 'Id'.

get_pyvisible(name)

returns an existing visible object identified by a unique text identifier. There is no need for typecasting.

set_focus(widget)

will set the focus to 'widget'

set_taborder( taborder[,registerchange [, forcesetting]])

sets the tab order (the focus order) of the widgets. 'taborder' is a list of the presentation numbers of the widgets, which should get the focus

goto_taborder_next()

will move the the focus to the next widget (see set_taborder )

goto_taborder_previous()

will move the the focus to the previous widget (see set_taborder )

goto_taborder_first()

will move the the focus to the first widget (see set_taborder )

goto_taborder_last()

will move the the focus to the last widget (see set_taborder )

show_asdialog([parentform])

Displays this form as a modal dialog. Use this method only, if this form was created via the hk_database.new_dialogformvisible() method. You can optionally set the parentform on which this form will always stay on top.

screen_width()

return the screen width

screen_height()

returns the screen height

The next program shows you how to start a form:

Example 2.9. displaying a form

myform=hk_this.datasource().database().new_formvisible()
myform.load_form("authorform")
myform.set_mode(myform.viewmode)