I'm trying to use the event handler to activate a subroutine when a user scans a barcode or fills a dialog box and presses enter.
Is the OnEnter event handler for such use ?
Here is a sample of the code
AddDialogHandler>Dialog1,Scan,OnEnter,DoEnter
Dialog>Dialog1
object Dialog1: TForm
Left = 251
Top = 104
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Open or Close Books'
ClientHeight = 216
ClientWidth = 439
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 86
Top = 48
Width = 68
Height = 13
Caption = 'Scan Barcode'
end
object Scan: TEdit
Left = 86
Top = 66
Width = 235
Height = 21
TabOrder = 8
end
object MSButton1: tMSButton
Left = 86
Top = 134
Width = 75
Height = 25
Caption = 'OK'
ModalResult = 1
TabOrder = 9
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton2: tMSButton
Left = 227
Top = 134
Width = 75
Height = 25
Caption = 'Finished'
ModalResult = 2
TabOrder = 10
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
SRT>DoEnter
GetDialogProperty>Dialog1,Scan,Text,varScan
MessageModal>Entered barcode is %varScan%
END>DoEnter
AddDialogHandler OnEnter
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 22
- Joined: Wed Nov 16, 2005 3:58 am
- Location: Gold Coast, Australia
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You would need the AddDialogHandler AFTER The dialog block because at the moment the dialog does not even exist when you call it so the script would have no idea what to do with it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Junior Coder
- Posts: 22
- Joined: Wed Nov 16, 2005 3:58 am
- Location: Gold Coast, Australia
My humble apologies, I cut and pasted the code fragments and in doing so put them in the wrong order.
I have since checked and it still doesn't work.
I did however read your email today about custom event triggers and saw a related post on keypress for eventhandlers. I have tried this method and it works like a charm.
One question though is OnEnter supposed to trigger when you press the Enter key ??
Alistair
I have since checked and it still doesn't work.
I did however read your email today about custom event triggers and saw a related post on keypress for eventhandlers. I have tried this method and it works like a charm.
One question though is OnEnter supposed to trigger when you press the Enter key ??
Alistair
-
- Junior Coder
- Posts: 22
- Joined: Wed Nov 16, 2005 3:58 am
- Location: Gold Coast, Australia