Dim frmParent
Sub Main
Set frmParent = IsahObjects.Get("EditFormObject")
frmParent.GridSQL = "SELECT * FROM T_Country"
frmParent.KeyField = "CountryCode"
frmParent.Tablename = "Country"
frmParent.FormTitle = "Editform with childbuttons"
frmParent.TabRecord.TabVisible = False
frmParent.GridEditAllowed = False
frmParent.EditInGrid = False
frmParent.PrimaryKey = "CountryCode"
frmParent.panExtra.Visible = True
Set btnChildMsgBox =IsahObjects.Get("IsahDBChildButtonObject")
btnChildMsgBox.Parent = frmParent.panExtra
btnChildMsgBox.Caption = "Custom Fields3"
btnChildMsgBox.onClick = "BtnChildMsgBoxOnClick"
Set btnChildForm=IsahObjects.Get("IsahDBChildButtonObject")
btnChildForm.Parent = frmParent.panExtra
btnChildForm.Caption = "Custom Fields2"
btnChildForm.onClick = "BtnChildFormOnClick"
Set btnChildEditForm =IsahObjects.Get("IsahDBChildButtonObject")
btnChildEditForm.Parent = frmParent.panExtra
btnChildEditForm.Caption = "Custom Fields"
btnChildEditForm.onClick = "BtnChildEditFormOnClick"
btnChildEditForm.TabOrder = 0
btnChildForm.TabOrder = 1
btnChildMsgBox.TabOrder = 2
frmParent.ShowModal
Set btnChildMsgBox = nothing
Set btnChildForm = nothing
Set btnChildEditForm = nothing
Set frmParent = nothing
End Sub
Sub BtnChildEditFormOnClick(Sender)
Set frmChild = IsahObjects.Get("EditFormObject")
frmChild.GridSQL = "SELECT * FROM ST_ScriptExample2 WHERE CountryCode=:CountryCode"
frmChild.FormTitle = "An editable child form"
frmChild.KeyField = "CountryCode"
frmChild.PrimaryKey = "CountryCode;CityCode"
frmChild.Tablename="ScriptExample2"
frmChild.GridEditAllowed = True
frmChild.EditInGrid = True
frmChild.ParentFormName=Sender.ParentFormName
frmChild.showmodal
Set frmChild = nothing
End sub
Sub BtnChildMsgBoxOnClick(Sender)
MsgBox frmParent.gridFieldByName("CountryCode").asString
End Sub
Sub BtnChildFormOnClick(Sender)
Dim frmChildForm, edtCountryCode
Set frmChildForm = IsahObjects.Get("TForm")
With frmChildForm
.Loading = True
.Name = "frmChildForm"
.Left = 417
.Top = 284
.Width = 314
.Height = 205
.Caption = "A linked Form object"
.Color = -16777201
.Font.Charset = 1
.Font.Color = -16777208
.Font.Height = -11
.Font.Name = "MS Sans Serif"
.Font.Style = 0
.OldCreateOrder = 0
.PixelsPerInch = 96
.TextHeight = 13
End With
Set edtCountryCode = IsahObjects.Get("TEdit")
With edtCountryCode
.Parent = frmChildForm
.Name = "edtCountryCode"
.Left = 136
.Top = 8
.Width = 121
.Height = 21
.TabOrder = 0
.Text = frmParent.gridFieldByName("CountryCode").asstring
End With
frmChildForm.Loading = False
frmChildForm.ShowModal
Set frmChildForm = nothing
End Sub