I really like OneEvent, my only problem is that once an Event handler is activated it remains active until you exit the script. My Suggestion is to be able to disable and enable OneEvent. There are areas in my scripts I don't want event handlers to branch to the specified Subroutine when the event occurs.
E.g.
Let>DISABLE_ONEVENT=True
Let>DISABLE_ONEVENT=False
Thank you listening.
Enable and Disable One Event
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You already can. Just specify a null string for the subroutine for the same event handler setup:
//enable
OnEvent>KEY_DOWN,VK32,0,KeyPress
...
...
//disable it
OnEvent>KEY_DOWN,VK32,0,
..
..
//enable it again
OnEvent>KEY_DOWN,VK32,0,KeyPress
//enable
OnEvent>KEY_DOWN,VK32,0,KeyPress
...
...
//disable it
OnEvent>KEY_DOWN,VK32,0,
..
..
//enable it again
OnEvent>KEY_DOWN,VK32,0,KeyPress
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?
Neither did I... Yes, please add to help file... thanks and take care.Rain wrote:Thanks Marcus!
I never thought to try that. Might be worth adding to the help file.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Re: Enable and Disable One Event
Is there a known issue when jumping into a subroutine by using an dialog handler instead of Gosub>?
I like to give the opportunity closing the dialog by pressing the ESC key. But also want to avoid closing the Macro while running a subroutine with some actions.
See the following sample code:
When using a dialog handler the onEvent handler isn't deaktivated.
In my productive script the subroutine hangs when jumping from the "DoAction" subroutine to OnEventKey to disable it.
I like to give the opportunity closing the dialog by pressing the ESC key. But also want to avoid closing the Macro while running a subroutine with some actions.
See the following sample code:
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 3521
Top = 278
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 113
ClientWidth = 476
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 BtnStart: tMSButton
Left = 202
Top = 40
Width = 75
Height = 25
Caption = 'Start'
TabOrder = 8
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
Let>strActivateESC=True
Gosub>OnEventKey
AddDialogHandler>Dialog1,BtnStart,OnClick,DoAction
#Gosub>DoAction
Label>DlgShow
Show>Dialog1,r
SRT>OnEventKey
If>strActivateESC=True
OnEvent>KEY_DOWN,VK27,0,DoClose
ELSE
OnEvent>KEY_DOWN,VK27,0,
ENDIF
End>OnEventKey
SRT>DoAction
MDL>Start Subroutine
Let>strActivateESC=False
Gosub>OnEventKey
Wait>10
MDL>Stop
END>DoAction
SRT>DoClose
Exit>0
END>DoClose
Label>Exit
In my productive script the subroutine hangs when jumping from the "DoAction" subroutine to OnEventKey to disable it.
regards
migro
migro
Re: Enable and Disable One Event
Looks to me like this could be related to the issue hagchr reported in this thread
Re: Enable and Disable One Event
Thx for the link, it looks very similar. Have you got any response from marcus upon your bugreport?
regards
migro
migro