Help with Checkbox in a dialog box.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Help with Checkbox in a dialog box.

Post by gchichester » Thu Jun 23, 2011 12:09 pm

I'm tring to autofill some fields based on a checkbox being true
I was successful auto filling a field using a ReadLn thats passed to a variable
But I can't seem to get the checkbox to work.
I did search the forum for "Checkbox" but what I found was not helpful
What am I missing?

Any and all responses are greatly appreciated

Gil Chichester

[code]
object BoLDialog: TForm
Left = 251
Top = 97
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Asia Bill of Lading Info'
ClientHeight = 405
ClientWidth = 632
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Times New Roman'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 15
object msLabel1: TLabel
Left = 17
Top = 51
Width = 77
Height = 15
Caption = 'Shipper Name:'
end
object msLabel2: TLabel
Left = 17
Top = 18
Width = 93
Height = 15
Caption = 'Booking Number:'
end
object msLabel3: TLabel
Left = 17
Top = 84
Width = 84
Height = 15
Caption = 'Bill of Lading #:'
end
object msLabel4: TLabel
Left = 17
Top = 117
Width = 56
Height = 15
Caption = 'Reference:'
end
object msLabel5: TLabel
Left = 17
Top = 153
Width = 72
Height = 15
Caption = 'Carrier Code :'
end
object msLabel6: TLabel
Left = 17
Top = 186
Width = 84
Height = 15
Caption = 'Departure Date:'
end
object msLabel7: TLabel
Left = 17
Top = 319
Width = 72
Height = 15
Caption = 'Loading Port:'
end
object msLabel8: TLabel
Left = 17
Top = 285
Width = 96
Height = 15
Caption = 'Port of Discharge:'
end
object msLabel9: TLabel
Left = 320
Top = 18
Width = 71
Height = 15
Caption = 'Vessel Name:'
end
object msLabel10: TLabel
Left = 321
Top = 51
Width = 65
Height = 15
Caption = 'Container #:'
end
object msLabel11: TLabel
Left = 321
Top = 84
Width = 70
Height = 15
Caption = 'Seal Number:'
end
object msLabel12: TLabel
Left = 321
Top = 117
Width = 104
Height = 15
Caption = 'Number of Cartons:'
end
object msLabel13: TLabel
Left = 321
Top = 319
Width = 91
Height = 15
Caption = 'Service Contract:'
end
object msLabel14: TLabel
Left = 321
Top = 252
Width = 33
Height = 15
Caption = 'Temp:'
end
object msLabel15: TLabel
Left = 321
Top = 285
Width = 34
Height = 15
Caption = 'Vents:'
end
object msLabel16: TLabel
Left = 321
Top = 153
Width = 76
Height = 15
Caption = 'Total Cartons:'
end
object PlaceRec: TLabel
Left = 17
Top = 252
Width = 88
Height = 15
Caption = 'Place of Receipt:'
end
object Label1: TLabel
Left = 321
Top = 186
Width = 98
Height = 15
Caption = 'Container Weight:'
end
object Label2: TLabel
Left = 321
Top = 221
Width = 77
Height = 15
Caption = 'Gross Weight:'
end
object Label3: TLabel
Left = 18
Top = 219
Width = 68
Height = 15
Caption = 'Arrival Date:'
end
object BkNumber: TEdit
Left = 126
Top = 14
Width = 147
Height = 23
TabOrder = 0
end
object BoLNumber: TEdit
Left = 126
Top = 80
Width = 147
Height = 23
TabOrder = 2
end
object ReferanceNum: TEdit
Left = 126
Top = 113
Width = 147
Height = 23
TabOrder = 3
end
object DepartureDate: TEdit
Left = 126
Top = 182
Width = 147
Height = 23
TabOrder = 5
end
object ContainerNum: TEdit
Left = 431
Top = 47
Width = 175
Height = 23
TabOrder = 11
end
object SealNum: TEdit
Left = 431
Top = 80
Width = 175
Height = 23
TabOrder = 12
end
object CartonQty: TEdit
Left = 431
Top = 113
Width = 175
Height = 23
TabOrder = 13
end
object TotalCartons: TEdit
Left = 431
Top = 149
Width = 175
Height = 23
TabOrder = 15
end
object Done: tMSButton
Left = 471
Top = 349
Width = 75
Height = 33
Caption = 'Done'
DoubleBuffered = True
ModalResult = 2
ParentDoubleBuffered = False
ParentShowHint = False
ShowHint = False
TabOrder = 21
DoBrowse = False
BrowseStyle = fbOpen
end
object ShipperName: tMSComboBox
Left = 126
Top = 47
Width = 147
Height = 23
ItemHeight = 15
TabOrder = 1
end
object LoadPort: tMSComboBox
Left = 126
Top = 281
Width = 147
Height = 23
ItemHeight = 15
TabOrder = 8
end
object DischargePort: tMSComboBox
Left = 126
Top = 314
Width = 147
Height = 23
ItemHeight = 15
TabOrder = 9
end
object Vent: tMSComboBox
Left = 431
Top = 281
Width = 175
Height = 23
ItemHeight = 15
TabOrder = 19
end
object VesselName: tMSComboBox
Left = 430
Top = 14
Width = 175
Height = 23
ItemHeight = 15
TabOrder = 10
end
object CarrierCode: tMSComboBox
Left = 126
Top = 149
Width = 147
Height = 23
ItemHeight = 15
TabOrder = 4
end
object Temperature: TEdit
Left = 431
Top = 248
Width = 175
Height = 23
TabOrder = 18
end
object SrvContract: TEdit
Left = 431
Top = 314
Width = 175
Height = 23
TabStop = False
TabOrder = 20
end
object PlaceOfRec: tMSComboBox
Left = 126
Top = 248
Width = 147
Height = 23
ItemHeight = 15
TabOrder = 7
Text = ' '
end
object GrossWeight: TEdit
Left = 431
Top = 215
Width = 175
Height = 23
TabOrder = 17
end
object ContainerWgt: TEdit
Left = 431
Top = 182
Width = 175
Height = 23
TabOrder = 16
end
object ArrivalDate: TEdit
Left = 126
Top = 215
Width = 147
Height = 23
TabOrder = 6
end
object CheckBox1: TCheckBox
Left = 322
Top = 134
Width = 52
Height = 17
BiDiMode = bdRightToLeft
Caption = 'Drums'
ParentBiDiMode = False
TabOrder = 14
end
end
EndDialog>BoLDialog

AddDialogHandler>BoLDialog,CarrierCode,OnExit,GetContractNum
AddDialogHandler>BoLDialog,GrossWeight,OnExit,GetWeight
SetDialogProperty>BoLDialog,ShipperName,ListText,comboList1
SetDialogProperty>BoLDialog,CarrierCode,ListText,comboList2
SetDialogProperty>BolDialog,LoadPort,ListText,comboList3
SetDialogProperty>BolDialog,DischargePort,ListText,comboList4
SetDialogProperty>BolDialog,VesselName,ListText,comboList5
SetDialogProperty>BolDialog,Vent,ListText,comboList
SetDialogProperty>BolDialog,PlaceOfRec,ListText,comboList6
AddDialogHandler>BoLDialog,LoadPort,OnExit,subLoadPort
AddDialogHandler>BoLDialog,DischargePort,OnExit,subUnLoadPort
AddDialogHandler>BoLDialog,CheckBox1,OnClick,SubDrums
Show>BoLDialog,r

If>r=1
GoSub>GetContractNum
EndIf

SRT>GetContractNum
Let>k=0
GetDialogProperty>BolDialog,ShipperName,Text,ShpName
GetDialogProperty>BolDialog,CarrierCode,Text,SLCode
Label>Start
Let>k=k+1
ReadLn>C:\CP_Macros\Asia\aContract.txt,k,strLine
If>strLine=##EOF##,end
Separate>strLine,comma,aContract
If>{(%ShpName% = %aContract_1%) AND (%SLCode% = %aContract_2%)}
SetDialogProperty>BolDialog,SrvContract,Text,%aContract_3%
EndIf
Goto>Start
Label>end
END>GetContractNum

SRT>SubDrums
If>%BolDialog.CheckBox1%=True
SetDialogProperty>BolDialog,Vent,Text,CLOSED
EndIf
MDL>BoxChecked
END>SubDrums
[/code]

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jun 23, 2011 12:28 pm

Redo your subroutine. You are not using version 12 syntax.

Code: Select all

SRT>SubDrums
 GetDialogProperty>BolDialog,CheckBox1,Checked,CB1Res
 If>%CB1Res%=True
  SetDialogProperty>BolDialog,Vent,Text,CLOSED
 EndIf
MDL>BoxChecked
END>SubDrums

gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Help with Checkbox in a dialog box

Post by gchichester » Thu Jun 23, 2011 1:33 pm

JRL,
Works as expedited.
Knowledge is a wonder thing, thanks for sharing

Gil Chichester

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts