Help with multiple Dialogs

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
krash2501
Newbie
Posts: 15
Joined: Thu Jul 21, 2016 7:04 pm

Help with multiple Dialogs

Post by krash2501 » Fri Mar 10, 2017 10:14 pm

I start my script with an Non module dialog from there is goes to one of 3 new dialogs. after the user is finished with the new dialog I want it to cycle back to the 1st non Module dialog, basicly start over but I run into a bunch of issues trying to do this.

Layout:
Non Module Dialog with 3 buttons
-button 1 goes to Dialog1
-button 2 goes to Dialog3
-button 3 goes to Dialog4
User selects a button and goes to new Dialog. User inputs info into fields and clicks Button "Done".

After "Done" button is pressed I would like for the original non Module Dialog appear and to start over as if the script was started fresh.

Here is a sample that I tried:

Code: Select all

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1

Dialog>Dialog
object Dialog: TForm
  Left = 257
  Top = 115
  HelpContext = 5000
  Anchors = [akLeft, akTop, akBottom]
  BorderIcons = [biSystemMenu]
  Caption = 'Carrier Invintory GUI'
  ClientHeight = 312
  ClientWidth = 209
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -14
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesigned
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 120
  TextHeight = 16
  object MSButton1: tMSButton
    Left = 56
    Top = 56
    Width = 97
    Height = 51
    Caption = 'MSButton1'
    TabOrder = 8
    DoBrowse = False
    BrowseStyle = fbOpen
    ModalResult = 10
  end
  object MSButton2: tMSButton
    Left = 58
    Top = 120
    Width = 95
    Height = 48
    Caption = 'MSButton2'
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
    ModalResult = 20
  end
  object MSButton3: tMSButton
    Left = 56
    Top = 184
    Width = 97
    Height = 49
    Caption = 'MSButton3'
    TabOrder = 10
    DoBrowse = False
    BrowseStyle = fbOpen
    ModalResult = 30
  end
end
EndDialog>Dialog

Show>Dialog,res1


if>res1=10
CloseDialog>Dialog
 goto>IGUI2
endif

if>res1=20
CloseDialog>Dialog
 GOTO>IGUI3
endif

if>res1=30
CloseDialog>Dialog
 GOTO>IGUI4
endif

srt>Restart
if>res1=10
CloseDialog>Dialog
 goto>IGUI2
endif

if>res1=20
CloseDialog>Dialog
 GOTO>IGUI3
endif

if>res1=30
CloseDialog>Dialog
 GOTO>IGUI4
endif
end>Restart


label>IGUI2

Dialog>Dialog1
object Dialog1: TForm
  Left = 246
  Top = 115
  HelpContext = 5000
  Anchors = [akLeft, akTop, akBottom]
  BorderIcons = [biSystemMenu]
  Caption = 'Carrier Invintory GUI'
  ClientHeight = 361
  ClientWidth = 235
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -14
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesigned
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 120
  TextHeight = 16
  object Label1: TLabel
    Left = 56
    Top = 84
    Width = 130
    Height = 16
    Caption = 'Scan Serial Numbers:'
  end
  object Label2: TLabel
    Left = 80
    Top = 20
    Width = 72
    Height = 16
    Caption = 'User Name:'
  end
  object Label4: TLabel
    Left = 104
    Top = 216
    Width = 101
    Height = 16
    Caption = 'Qty Checked out:'
  end
  object Edit1: TEdit
    Left = 32
    Top = 46
    Width = 170
    Height = 24
    TabOrder = 0
  end
  object Edit3: TEdit
    Left = 32
    Top = 110
    Width = 170
    Height = 24
    TabOrder = 1
  end
  object MSMemo1: tMSMemo
    Left = 41
    Top = 146
    Width = 56
    Height = 191
    VertScrollBarStyles.ButtonSize = 21
    HorzScrollBarStyles.ButtonSize = 21
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 117
    Top = 315
    Width = 75
    Height = 25
    Caption = 'Done'
    TabOrder = 3
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit4: TEdit
    Left = 123
    Top = 238
    Width = 70
    Height = 24
    TabOrder = 4
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,EDIT3,OnKeyDown,DoClick(1)
AddDialogHandler>Dialog1,MSBUTTON1,OnClick,Quit
AddDialogHandler>Dialog1,,OnClose,Quit

Show>dialog1,

SRT>DoClick
  If>DoClick_key=13
    //Do Something
    Endif
END>DoClick


label>IGUI3
Dialog>Dialog3
object Dialog3: TForm
  Left = 246
  Top = 115
  HelpContext = 5000
  Anchors = [akLeft, akTop, akBottom]
  BorderIcons = [biSystemMenu]
  Caption = 'Carrier Invintory GUI'
  ClientHeight = 282
  ClientWidth = 221
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -14
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesigned
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 120
  TextHeight = 16
  object Label1: TLabel
    Left = 48
    Top = 12
    Width = 130
    Height = 16
    Caption = 'Scan Serial Numbers:'
  end
  object Label4: TLabel
    Left = 96
    Top = 144
    Width = 93
    Height = 16
    Caption = 'Qty Checked In:'
  end
  object Edit3: TEdit
    Left = 24
    Top = 38
    Width = 170
    Height = 24
    TabOrder = 0
  end
  object MSMemo1: tMSMemo
    Left = 33
    Top = 74
    Width = 56
    Height = 191
    VertScrollBarStyles.ButtonSize = 21
    HorzScrollBarStyles.ButtonSize = 21
    TabOrder = 1
  end
  object MSButton1: tMSButton
    Left = 109
    Top = 243
    Width = 75
    Height = 25
    Caption = 'Done'
    TabOrder = 2
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit4: TEdit
    Left = 115
    Top = 166
    Width = 70
    Height = 24
    TabOrder = 3
  end
end
EndDialog>Dialog3

AddDialogHandler>Dialog3,EDIT3,OnKeyDown,DoClick3(1)
AddDialogHandler>Dialog3,MSBUTTON1,OnClick,Quit
AddDialogHandler>Dialog3,,OnClose,Quit

Show>dialog3,

SRT>DoClick3
  If>DoClick3_key=13
    //Do something
    Endif
END>DoClick3


label>IGUI4

Dialog>Dialog4
object Dialog4: TForm
  Left = 246
  Top = 115
  HelpContext = 5000
  Anchors = [akLeft, akTop, akBottom]
  BorderIcons = [biSystemMenu]
  Caption = 'Carrier Invintory GUI'
  ClientHeight = 209
  ClientWidth = 217
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -14
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesigned
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 120
  TextHeight = 16
  object Label1: TLabel
    Left = 44
    Top = 10
    Width = 130
    Height = 16
    Caption = 'Scan Serial Numbers:'
  end
  object Label4: TLabel
    Left = 96
    Top = 82
    Width = 83
    Height = 16
    Caption = 'Qty Reported:'
  end
  object Edit3: TEdit
    Left = 27
    Top = 30
    Width = 165
    Height = 24
    TabOrder = 0
  end
  object MSMemo1: tMSMemo
    Left = 25
    Top = 64
    Width = 56
    Height = 113
    VertScrollBarStyles.ButtonSize = 21
    HorzScrollBarStyles.ButtonSize = 21
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 101
    Top = 155
    Width = 75
    Height = 25
    Caption = 'Done'
    TabOrder = 3
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit4: TEdit
    Left = 107
    Top = 102
    Width = 62
    Height = 24
    TabOrder = 1
  end
end
EndDialog>Dialog4

AddDialogHandler>Dialog4,EDIT3,OnKeyDown,DoData(1)
AddDialogHandler>Dialog4,MSBUTTON1,OnClick,Quit
AddDialogHandler>Dialog4,,OnClose,Quit

Show>Dialog4,


SRT>DoData
  If>DoData_key=13
    //Do something
    Endif
END>DoData

SRT>Quit
  gosub>Restart
END>Quit


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

Re: Help with multiple Dialogs

Post by JRL » Sat Mar 11, 2017 3:31 am

I would suggest something like this.

Code: Select all

Dialog>Dialog
object Dialog: TForm
  Left = 384
  Top = 124
  HelpContext = 5000
  Anchors = [akLeft, akTop, akBottom]
  BorderIcons = []
  Caption = 'Carrier Invintory GUI'
  ClientHeight = 290
  ClientWidth = 170
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesigned
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 13
  object MSButton1: tMSButton
    Left = 46
    Top = 46
    Width = 75
    Height = 41
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    Caption = 'MSButton1'
    ModalResult = 10
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 46
    Top = 98
    Width = 75
    Height = 39
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    Caption = 'MSButton2'
    ModalResult = 20
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton3: tMSButton
    Left = 46
    Top = 150
    Width = 75
    Height = 39
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    Caption = 'MSButton3'
    ModalResult = 30
    TabOrder = 2
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton4: tMSButton
    Left = 46
    Top = 244
    Width = 75
    Height = 25
    Caption = 'Exit'
    TabOrder = 11
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog

Dialog>Dialog1
object Dialog1: TForm
  Left = 378
  Top = 204
  HelpContext = 5000
  Anchors = [akLeft, akTop, akBottom]
  BorderIcons = []
  Caption = 'Carrier Invintory GUI'
  ClientHeight = 293
  ClientWidth = 191
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesigned
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 46
    Top = 68
    Width = 102
    Height = 13
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    Caption = 'Scan Serial Numbers:'
  end
  object Label2: TLabel
    Left = 65
    Top = 16
    Width = 56
    Height = 13
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    Caption = 'User Name:'
  end
  object Label4: TLabel
    Left = 85
    Top = 176
    Width = 83
    Height = 13
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    Caption = 'Qty Checked out:'
  end
  object Edit1: TEdit
    Left = 26
    Top = 37
    Width = 138
    Height = 21
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    TabOrder = 0
  end
  object Edit3: TEdit
    Left = 26
    Top = 89
    Width = 138
    Height = 21
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    TabOrder = 1
  end
  object MSMemo1: tMSMemo
    Left = 33
    Top = 119
    Width = 46
    Height = 191
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 95
    Top = 256
    Width = 61
    Height = 20
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    Caption = 'Done'
    TabOrder = 3
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit4: TEdit
    Left = 100
    Top = 193
    Width = 57
    Height = 21
    Margins.Left = 2
    Margins.Top = 2
    Margins.Right = 2
    Margins.Bottom = 2
    TabOrder = 4
  end
end
EndDialog>Dialog1

Dialog>Dialog3
object Dialog3: TForm
  Left = 246
  Top = 115
  HelpContext = 5000
  Anchors = [akLeft, akTop, akBottom]
  BorderIcons = []
  Caption = 'Carrier Invintory GUI'
  ClientHeight = 282
  ClientWidth = 221
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -14
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesigned
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 120
  TextHeight = 16
  object Label1: TLabel
    Left = 48
    Top = 12
    Width = 130
    Height = 16
    Caption = 'Scan Serial Numbers:'
  end
  object Label4: TLabel
    Left = 96
    Top = 144
    Width = 93
    Height = 16
    Caption = 'Qty Checked In:'
  end
  object Edit3: TEdit
    Left = 24
    Top = 38
    Width = 170
    Height = 24
    TabOrder = 0
  end
  object MSMemo1: tMSMemo
    Left = 33
    Top = 74
    Width = 56
    Height = 191
    VertScrollBarStyles.ButtonSize = 21
    HorzScrollBarStyles.ButtonSize = 21
    TabOrder = 1
  end
  object MSButton1: tMSButton
    Left = 109
    Top = 243
    Width = 75
    Height = 25
    Caption = 'Done'
    TabOrder = 2
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit4: TEdit
    Left = 115
    Top = 166
    Width = 70
    Height = 24
    TabOrder = 3
  end
end
EndDialog>Dialog3

Dialog>Dialog4
object Dialog4: TForm
  Left = 246
  Top = 115
  HelpContext = 5000
  Anchors = [akLeft, akTop, akBottom]
  BorderIcons = []
  Caption = 'Carrier Invintory GUI'
  ClientHeight = 209
  ClientWidth = 217
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -14
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDesigned
  ShowHint = True
  OnTaskBar = True
  PixelsPerInch = 120
  TextHeight = 16
  object Label1: TLabel
    Left = 44
    Top = 10
    Width = 130
    Height = 16
    Caption = 'Scan Serial Numbers:'
  end
  object Label4: TLabel
    Left = 96
    Top = 82
    Width = 83
    Height = 16
    Caption = 'Qty Reported:'
  end
  object Edit3: TEdit
    Left = 27
    Top = 30
    Width = 165
    Height = 24
    TabOrder = 0
  end
  object MSMemo1: tMSMemo
    Left = 25
    Top = 64
    Width = 56
    Height = 113
    VertScrollBarStyles.ButtonSize = 21
    HorzScrollBarStyles.ButtonSize = 21
    TabOrder = 2
  end
  object MSButton1: tMSButton
    Left = 101
    Top = 155
    Width = 75
    Height = 25
    Caption = 'Done'
    TabOrder = 3
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit4: TEdit
    Left = 107
    Top = 102
    Width = 62
    Height = 24
    TabOrder = 1
  end
end
EndDialog>Dialog4

AddDialogHandler>Dialog,msButton1,OnClick,DoDialog1
AddDialogHandler>Dialog,msButton2,OnClick,DoDialog3
AddDialogHandler>Dialog,msButton3,OnClick,DoDialog4
AddDialogHandler>Dialog,msButton4,OnClick,Quit

AddDialogHandler>Dialog1,EDIT3,OnKeyDown,DoClick(1)
AddDialogHandler>Dialog1,MSBUTTON1,OnClick,Return

AddDialogHandler>Dialog3,EDIT3,OnKeyDown,DoClick3(1)
AddDialogHandler>Dialog3,MSBUTTON1,OnClick,Return

AddDialogHandler>Dialog4,EDIT3,OnKeyDown,DoData(1)
AddDialogHandler>Dialog4,MSBUTTON1,OnClick,Return


Show>Dialog

Label>Loop
Wait>0.01
Goto>Loop

SRT>DoDialog1
  CloseDialog>Dialog
  Show>dialog1,
END>DoDialog1

SRT>DoDialog3
  CloseDialog>Dialog
  Show>dialog3,
END>DoDialog3

SRT>DoDialog4
  CloseDialog>Dialog
  Show>dialog4,
END>DoDialog4



SRT>DoClick
  If>DoClick_key=13
    //Do Something
  Endif
END>DoClick

SRT>DoClick3
  If>DoClick3_key=13
    //Do something
  Endif
END>DoClick3
label>IGUI4

SRT>DoData
  If>DoData_key=13
    //Do something
  Endif
END>DoData

SRT>Quit
  Exit>0
END>Quit

SRT>Return
  CloseDialog>Dialog1
  CloseDialog>Dialog3
  CloseDialog>Dialog4
  Show>Dialog
END>Return

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