Page 1 of 1
How to detect (event) Browse/run modes?
Posted: Thu Oct 16, 2008 8:27 am
by ale870
Hi,
using "tools palette" i can switch between pointer mode (design) and Run (browse).
Is there any even (on....) to detect this switch in a stack?
I need to enable some functionalities (revBrowser) only when the program is running (Tool->Run) and disable the component at design-time.
I tried to search some information in the forum, but I cannot find anything useful since I don't know exactly which keywords I need to search: browse? Run? Design? Pointer? etc...
Thank you!

Posted: Thu Oct 16, 2008 8:37 am
by Klaus
Hi ale870,
there is no built-in solution for that, but you can check "the tool", see the docs.
Code: Select all
...
if the tool = "pointer tool" then
## edit mode
else
## browse tool
end if
...
Best
Klaus
Posted: Thu Oct 16, 2008 9:06 am
by ale870
But where can I put that code?
I have no event, I need to make a timer-based system (e.g. check every 5 seconds) to verify in which status is the software?
Posted: Thu Oct 16, 2008 10:01 am
by Klaus
ale870 wrote:But where can I put that code?
I have no event, I need to make a timer-based system (e.g. check every 5 seconds) to verify in which status is the software?
Hi ale870,
yes, you will need to check regularly.
Quick thought:
Put a script into your stack and call it on preopnestack or even manually.
Something like:
Code: Select all
command check_the_tool
if the tool = "pointer tool" then
## EDIT mode, do your stuff here
else
## BROWSE mode, do your other stuff here
end if
send "check_the_tool" to me in 2 secs
end check_the_tool
See these terms in the docs:
send...in...
pendingmessages
To be honest I still do not get what you are after...

Even with some functionalities disabled, you can still enable them again since you are in the IDE!!!???
Best
Klaus
Posted: Thu Oct 16, 2008 1:17 pm
by malte
Hi,
you can handle the newTool message in a frontscript. Do not forget to pass it.
Cheers,
Malte
Posted: Thu Oct 16, 2008 1:39 pm
by ale870
Well,
my problem is I'm working with revBrowser and I need to close it at design-time.
@malte can you better explain me how can I do with your system?
Thank you!
Posted: Thu Oct 16, 2008 5:14 pm
by SparkOut
Answering for malte - I believe he means something along the following lines:
Make an object (can be anything - I would say a button set to invisible, for example).
Give it the script
Code: Select all
on newTool tTool
switch tTool
case "browse"
answer "browse"
--close revBrowser and do what you need in browse mode
break
case "pointer"
answer "pointer"
--do what you need to do in pointer mode
break
end switch
pass newTool
end newTool
note you should not include an "on mouseUp" handler.
In the message box type
Code: Select all
insert script of button "<your button name>" into front
The script of the (hidden) button is now a "frontscript" which means it will receive messages before the engine, hence you need to pass the newTool message to allow the engine to react to it.
To remove the script, quite logically, you use
Code: Select all
remove script of button "<your button name>" from front
Posted: Thu Oct 16, 2008 5:23 pm
by ale870
Yes! This is the "final" answer I was looking for!
Thank you to everyone for your help!
