Previous Topic

Next Topic

Inhoudsopgave

Book Index

CreateEditForm Function

Although the IsahForms object still functions as before, it is recommended that you start using the new TForm Object as the basis for creating custom forms in Isah. The TForm object offers improved possibilities for customizing all types of Isah forms. In a future release of Isah, the IsahForms object will become unavailable.

Function Function CreateEditForm( [GeneralTabName: String] ): IsahEditForm_Object

Description

Creates an empty form, in which you can place various controls.

Parameters

Result

An IsahEditForm object.

Remarks

When the form is displayed, you can hold the left CTRL key while right-clicking the Cancel button. This opens an Info form containing information on the length, width, position and height of the form. This makes it easy to determine the SetBounds values.

Example

dim form, X, Y

dim combobox, radiobuttons, label, edit, checkbox, calcedit, memo, dateedit, button, lookup

dim countryqueryobject, countryquerytext

Sub main()

if ShowEditForm = 1 then

'MsgBox "You have confirmed the data entry"

End If

End Sub

Function ShowEditForm()

' Create an empty form

Set form = application.IsahForms.CreateEditform

' Set the form properties

form.Caption = "Basic data entry form"

form.SetBounds0,0,800,400

form.Center

' Turn on the status bar

form.statusbarvisible = true

form.usermessage("User")

form.hintmessage("Hint")

' Add controls

set edit = form.AddEdit ("Edit",,,,"&Edit field example","Text example","99999")

set checkbox = form.AddCheckBox ("Checkbox",,,,"&Check box example",true)

set calcedit = form.AddCalcEdit ("Calcedit",,,,"C&alcEdit field example","123")

calcedit.mask = "00000,00"

set radiobuttons = form.AddRadioButtons ("Radiobuttons",,,,,"Ra&diobuttons example","1;2;3;4",3,2)

RadioButtons.Items = Application.GetTypeString("Gender")

RadioButtons.ItemIndex = Application.GetTypeStringValue("Gender","Man")

RadioButtons.Columns= 2

set label= form.addlabel("Label",,,"&Label example")

' Create a second column with entry fields

' Begin at the top

form.XOffSet = 350

form.YOffSet = Y

X = form.EditOffSet + form.XOffSet

set combobox = form.AddComboBox ("Combobox",,,,"C&omboBox example","One A;Two B;Three C;Four D",3,false)

ComboBox.Items = Application.GetTypeString("OrdCode")

ComboBox.ItemIndex = Application.GetTypeStringValue("OrdCode","Phantom")

set button = form.addbutton ("Button","&Button example",0,0,0,0)

set dateedit = form.addDateEdit ("dateedit",,,,"Da&teedit example",date())

countryquerytext = "select countrycode, description from country"

set countryqueryobject = application.database.createquery(countryquerytext)

set lookup = form.addlookup ("Lookup",countryqueryobject,0,0,0,"Lookup example","Example of text in look-up screen","Description","Netherlands",false)

' Add a tab and select it to place controls on it

form.AddTab "SecondTab","Second Tab"

form.SelectTab "SecondTab"

set memo = form.AddMemo ("Memo",0,0,0,0,"Memo Example","Enter your memo text" & vbcrlf, true)

' Select the first tab and change the name

form.SelectTab "General"

form.SetTabCaption ( "First tab")

' Display the form

ShowEditForm = form.ShowModal

' Display the results

'msgbox form.GetValueByName("Edit1")

'msgbox form.GetValueByName("CB1b")

End Function

Sub IsahEvent_OnClick(Id)

' Handle clicking of button

If Button.GetId = ID Then

MsgBox "You have clicked this button, setfocus will now be used to position the pointer to the first field. Also note the check box!"

edit.setfocus

' Enable or disable the check box

checkbox.enabled = not checkbox.enabled

End If

End Sub

sub IsahEvent_OnEnter(id)

form.hintmessage ( "You selected the field with ID " & id & " ")

if calcedit.getid = id then

' msgbox "You are now in the calcedit field"

end if

end sub

sub IsahEvent_OnExit(id)

form.usermessage ( "You left field with ID " & id & " ")

memo.setvalue (memo.getvalue & " id " & id & vbcrlf)

if edit.getid = id then

'msgbox "You are leaving the edit"

end if

end sub

sub isahEvent_onChange (id)

if combobox.getid = id then

' msgbox "The combo box value has changed"

end if

end sub

Function IsahEvent_OnPageChange(Name, Forward)

If Name = "General" then

MsgBox "Hello"

end if

IsahEvent_OnPageChange = true

End Function