Previous Topic

Next Topic

Inhoudsopgave

Book Index

Process Form With Visual Components Code Snippet

Remarks

This code snippet shows how to create an instance of a standard Isah Process form. It shows:

Dim btnStart, btnCancel

Dim oParamNewFieldDate

Dim frmProcess, dtpFieldDate

Sub main

rem Create the form

Set frmProcess = IsahObjects.Get("FormIsahProcessObject")

frmProcess.Loading = True

rem Call CreatePersistentFields

Set oParamNewFieldDate = IsahObjects.Get("IsahDateTimeField")

with oParamNewFieldDate

.Name="NewFieldDate"

.FieldName="NewFieldDate"

.Dataset=frmProcess.Dataset

end with

rem more persistence fields...

rem Initialize the components

Set dtpFieldDate = IsahObjects.Get("TDateTimePicker")

With dtpFieldDate

.Parent = grpbxDateIntegerFields

.Name = "dtpFieldDate"

.Left = 8

.Top = 48

.Width = 186

.Height = 21

.Date = 38777.680824108790000000

.Time = 38777.680824108790000000

.TabOrder = 0

End With

rem more components...

frmProcess.Loading = False

frmProcess.ProgramCode=1500000003 '2800000

frmProcess.FormTitle="Example ProcessForm"

frmProcess.StoredProcName="SIP_prc_ScriptExample"

frmProcess.btnApply.Enabled = False

Rem Save pointers to the button-objects

Set btnStart = frmProcess.btnStart

Set btnCancel = frmProcess.btnCancel

Rem Tell the button that it is linked to the current script

Rem and link the click-event to a script-function

btnStart.Script = Script

btnCancel.Script = Script

btnStart.OnClickEvent = "OnClickButton"

btnCancel.OnClickEvent = "OnClickButtonCancel"

frmProcess.showmodal

Rem destroy objects

Set btnStart = nothing

Set btnCancel = nothing

Set oParamNewFieldDate = nothing

Set frmProcess = nothing

End Sub

Sub OnClickButtonCancel

MsgBox "Before cancel"

btnCancel.OldClick

MsgBox "After cancel"

End Sub

Sub OnClickButton

Rem You can run your code before, after or instead of the original processing

Rem For example begin with simple field validation

Rem Then, assign values from non data aware components to persistent fields

oParamNewFieldDate.asString = formatdatetime(cdate(dtpFieldDate.Date),vbShortDate )

Rem start the process

btnStart.OldClick

Rem after the process, write code to show the updated records

End Sub