Exit should be working outside of debug. I'll get that looked at.
However .....
If it's a modal dialog then just give the button a ModalResult value to make it close the dialog when clicked.
In v12 if it's a modal dialog and you don't want the button to close it then leave the button's modalresult to 0 and then simply call CloseDialog in the buttons click handler. This will close the dialog with a modal result of 2:
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 390
Top = 182
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 223
ClientWidth = 439
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 MSButton1: tMSButton
Left = 179
Top = 73
Width = 75
Height = 25
Caption = 'MSButton1'
DoubleBuffered = True
ParentDoubleBuffered = False
TabOrder = 8
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,msButton1,OnClick,DoClick
Show>Dialog1,r
SRT>DoClick
//do what you need here and if required ...
CloseDialog>Dialog1
END>DoClick
In v12 you should very rarely need a non-modal dialog. But if you do want a non-modal dialog you could do something like this:
Code: Select all
AddDialogHandler>Dialog1,msButton1,OnClick,DoClick
Show>Dialog1
Label>someloop
Wait>0.2
If>endit<>true
Goto>someloop
Endif
SRT>DoClick
//do what you need here and if required ...
CloseDialog>Dialog1
Let>endit=true
END>DoClick
So the click closes the dialog, sents endit to true, which causes the main loop to terminate.