Why is Dialog3 closing??? Please Help!!

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Why is Dialog3 closing??? Please Help!!

Post by PepsiHog » Sun Nov 11, 2012 6:40 pm

Hello Everyone,

I usually use AddDialogHandler. But I wanted to keep it simple (simple not so simple for me). Nothing yet really works per say. I have Dialog1 set up. When you click the MenuItem Options/Setup is where I am having trouble. It displays Dialog3. When I click the Browse button in Dialog3 it closes dialog3 before displaying the file browser. And I don't want it to.
I want it to remain til Ok or Cancel is clicked.

I don't usually go with this method, that's why I'm clueless why it's closing.

Here is what I have. Also, please don't suggest watching the video. I already did. No helperoni.

Code: Select all


OnEvent>Key_Down,VK113,0,DoExit

let>FPath=%Desktop_Dir%
IfFileExists>Console.ini
else
WriteLn>%Fpath%\Console.ini,wtf,[details]
endif

Dialog>Dialog1
object Dialog1: TForm
  Left = 251
  Top = 104
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Communications One'
  ClientHeight = 441
  ClientWidth = 438
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  Menu = MainMenu
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 8
    Top = 88
    Width = 70
    Height = 16
    Caption = 'Command'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label2: TLabel
    Left = 16
    Top = 120
    Width = 53
    Height = 16
    Caption = 'Section'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label3: TLabel
    Left = 24
    Top = 152
    Width = 34
    Height = 16
    Caption = 'Main'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label4: TLabel
    Left = 16
    Top = 184
    Width = 59
    Height = 16
    Caption = 'Includes'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label5: TLabel
    Left = 192
    Top = 232
    Width = 148
    Height = 16
    Caption = 'Available Commands'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label6: TLabel
    Left = 24
    Top = 56
    Width = 37
    Height = 16
    Caption = 'Type'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label7: TLabel
    Left = 24
    Top = 232
    Width = 59
    Height = 16
    Caption = 'Includes'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Edit1: TEdit
    Left = 96
    Top = 80
    Width = 335
    Height = 21
    Hint = 'Available Commands or New Command'
    TabOrder = 0
  end
  object Edit2: TEdit
    Left = 96
    Top = 112
    Width = 335
    Height = 21
    Hint = 'New Command or New Section'
    TabOrder = 1
  end
  object Edit3: TEdit
    Left = 96
    Top = 144
    Width = 292
    Height = 21
    Hint = 'Main Routine to Call'
    TabOrder = 2
  end
  object Edit4: TEdit
    Left = 96
    Top = 176
    Width = 292
    Height = 21
    Hint = 'Routines to Include'
    TabOrder = 3
  end
  object MSComboBox1: tMSComboBox
    Left = 96
    Top = 51
    Width = 145
    Height = 19
    Style = csOwnerDrawFixed
    ItemHeight = 13
    TabOrder = 4
  end
  object MSButton1: tMSButton
    Left = 356
    Top = 394
    Width = 75
    Height = 25
    Caption = 'OK'
    DoubleBuffered = True
    ParentDoubleBuffered = False
    TabOrder = 5
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 356
    Top = 370
    Width = 75
    Height = 25
    Caption = 'Cancel'
    DoubleBuffered = True
    ParentDoubleBuffered = False
    TabOrder = 6
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton3: tMSButton
    Left = 392
    Top = 144
    Width = 31
    Height = 21
    DoubleBuffered = True
    Glyph.Data = {
      F6000000424DF600000000000000760000002800000010000000100000000100
      0400000000008000000000000000000000001000000010000000000000000000
      80000080000000808000800000008000800080800000C0C0C000808080000000
      FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
      77777777777777777777000000000007777700333333333077770B0333333333
      07770FB03333333330770BFB0333333333070FBFB000000000000BFBFBFBFB07
      77770FBFBFBFBF0777770BFB0000000777777000777777770007777777777777
      7007777777770777070777777777700077777777777777777777}
    ParentDoubleBuffered = False
    TabOrder = 7
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton4: tMSButton
    Left = 392
    Top = 176
    Width = 32
    Height = 21
    DoubleBuffered = True
    Glyph.Data = {
      F6000000424DF600000000000000760000002800000010000000100000000100
      0400000000008000000000000000000000001000000010000000000000000000
      80000080000000808000800000008000800080800000C0C0C000808080000000
      FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
      77777777777777777777000000000007777700333333333077770B0333333333
      07770FB03333333330770BFB0333333333070FBFB000000000000BFBFBFBFB07
      77770FBFBFBFBF0777770BFB0000000777777000777777770007777777777777
      7007777777770777070777777777700077777777777777777777}
    ParentDoubleBuffered = False
    TabOrder = 8
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton5: tMSButton
    Left = 352
    Top = 257
    Width = 75
    Height = 25
    Caption = 'Details'
    DoubleBuffered = True
    ParentDoubleBuffered = False
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Panel1: TPanel
    Left = 24
    Top = 250
    Width = 316
    Height = 169
    TabOrder = 10
    object Splitter1: TSplitter
      Left = 122
      Top = 1
      Width = 5
      Height = 167
      ExplicitLeft = 137
    end
    object MSListBox1: tMSListBox
      Left = 127
      Top = 1
      Width = 188
      Height = 167
      Align = alClient
      ItemHeight = 13
      TabOrder = 0
      SelectedIndex = -1
      ExplicitLeft = 181
      ExplicitTop = 32
      ExplicitWidth = 121
      ExplicitHeight = 97
    end
    object MSListBox2: tMSListBox
      Left = 1
      Top = 1
      Width = 121
      Height = 167
      Align = alLeft
      ItemHeight = 13
      TabOrder = 1
      SelectedIndex = -1
      ExplicitLeft = 25
      ExplicitTop = 11
      ExplicitHeight = 97
    end
  end
  object MainMenu: tMSMainMenu
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    object MenuItem1: tMSMenuItem
      Caption = 'File'
      object MenuItem2: tMSMenuItem
        Caption = 'Exit'
      end
    end
    object MenuItem3: tMSMenuItem
      Caption = 'Options'
      object MenuItem4: tMSMenuItem
        Caption = 'Setup'
      end
    end
  end
end
EndDialog>Dialog1


Dialog>Dialog3
object Dialog3: TForm
  Left = 251
  Top = 104
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Setup'
  ClientHeight = 216
  ClientWidth = 480
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 16
    Top = 32
    Width = 155
    Height = 16
    Caption = 'Path for Local (.ini) file'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object MSButton1: tMSButton
    Left = 384
    Top = 170
    Width = 75
    Height = 25
    Caption = 'OK'
    DoubleBuffered = True
    ModalResult = 1
    ParentDoubleBuffered = False
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 384
    Top = 145
    Width = 75
    Height = 25
    Caption = 'Cancel'
    DoubleBuffered = True
    ModalResult = 2
    ParentDoubleBuffered = False
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit1: TEdit
    Left = 181
    Top = 27
    Width = 188
    Height = 21
    TabOrder = 2
  end
  object MSButton3: tMSButton
    Left = 377
    Top = 26
    Width = 24
    Height = 25
    DoubleBuffered = True
    Glyph.Data = {
      F6000000424DF600000000000000760000002800000010000000100000000100
      0400000000008000000000000000000000001000000010000000000000000000
      80000080000000808000800000008000800080800000C0C0C000808080000000
      FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
      77777777777777777777000000000007777700333333333077770B0333333333
      07770FB03333333330770BFB0333333333070FBFB000000000000BFBFBFBFB07
      77770FBFBFBFBF0777770BFB0000000777777000777777770007777777777777
      7007777777770777070777777777700077777777777777777777}
    ModalResult = 3
    ParentDoubleBuffered = False
    TabOrder = 3
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog3

// Dialog1
AddDialogHandler>Dialog1,MSButton4,OnClick,DoBrowse
AddDialogHandler>Dialog1,MSButton2,OnClick,DoExit
AddDialogHandler>Dialog1,MenuItem2,OnClick,DoExit
AddDialogHandler>Dialog1,MenuItem4,OnClick,DoSetup


srt>DoSetup

Show>Dialog3,res

While>res<2>res=1
endif
if>res=2
    mdl>Closing.
   // CloseDialog>Dialog3
endif
if>res=3
   //  ReadIniFile>%Fpath%\Config.ini,InitialDir,Open,DoOpen
  //SetDialogProperty>Dialog1,MSButton1,InitialDir,%DoOpen%
  SetDialogProperty>Dialog3,MSButton3,DoBrowse,True
  GetDialogProperty>Dialog3,MSButton3,Filename,strFileName
  SetDialogProperty>Dialog3,Edit1,Text,strFileName
  //ReadFile>strFileName,strFileData
  //SetDialogProperty>Dialog1,MSMemo1,Text,strFileData
  let>res=0
endif
EndWhile
mdl>Shit
END>DoSetup


Show>Dialog1,r


SRT>DoBrowse
  //ReadIniFile>%Fpath%\Config.ini,InitialDir,Open,DoOpen
  //SetDialogProperty>Dialog1,MSButton1,InitialDir,%DoOpen%
  SetDialogProperty>Dialog1,MSButton4,DoBrowse,True
  GetDialogProperty>Dialog1,MSButton4,Filename,strFileName
  SetDialogProperty>Dialog1,Edit4,Text,strFileName
  //ReadFile>strFileName,strFileData
  //SetDialogProperty>Dialog1,MSMemo1,Text,strFileData
END>DoBrowse

srt>DoExit
  exit
END>DoExit
I hope this code isn't too long. Sorry if it is.

Please help.
PepsiHog


Marcus,

Suggestion / question. Could you make dialogs collapse in these posts like it does in MS? It would make it easier to copy.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

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

Post by JRL » Mon Nov 12, 2012 4:25 am

try this for your DoSetup subroutine.

Code: Select all

srt>DoSetup

Label>ShowDialog3
Show>Dialog3,res

While>res>1
If>res>1
  Show>Dialog3
EndIf
If>res=1
  let>res=0
  CloseDialog>Dialog3
endif
if>res=2
    mdl>Closing.
    let>res=0
    CloseDialog>Dialog3
endif
if>res=3
   //  ReadIniFile>%Fpath%\Config.ini,InitialDir,Open,DoOpen
  //SetDialogProperty>Dialog1,MSButton1,InitialDir,%DoOpen%
  SetDialogProperty>Dialog3,MSButton3,DoBrowse,True
  GetDialogProperty>Dialog3,MSButton3,Filename,strFileName
  SetDialogProperty>Dialog3,Edit1,Text,strFileName
  //ReadFile>strFileName,strFileData
  //SetDialogProperty>Dialog1,MSMemo1,Text,strFileData
  let>res=0
  Goto>ShowDialog3
endif
EndWhile
END>DoSetup

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Hello

Post by PepsiHog » Tue Nov 13, 2012 1:24 am

Thanks JRL.

PepsiHog.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

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