Page 1 of 1

Message to detect BROWSE/EDITOR switching?

Posted: Wed Nov 11, 2009 11:38 am
by ale870
Hello,

I want to create a message to perform some operations when I switch my program from editing (design) and browse (run). In fact I need to eliminate windows borders, set background, move window, etc... for testing (running) but I want to set normal stack properties when I switch to EDITING.
Which event can I use to detect browse/editor status?

Thank you for your help!

Posted: Wed Nov 11, 2009 12:04 pm
by SparkOut
You're in luck - there is the "newTool" message you can handle in this case:
the RunRev dictionary wrote:Examples:
on newTool newTool
if newTool is "Browse" then show stack "Editing Tools"
else hide stack "Editing Tools"
end newTool


Handle the newTool message if you want to change something when a tool is chosen. For example, you might want to show a particular palette window only with the Browse tool.
HTH
SparkOut

Posted: Wed Nov 11, 2009 1:30 pm
by ale870
Thank you! That's I was looking for!

EDIT: Oh no! That message is available only on Mac platform! :(

Posted: Wed Nov 11, 2009 2:57 pm
by Mark
ale870,

Why do you think that the newTool message doesn't work on Windows and Linux?

Mark

Posted: Wed Nov 11, 2009 3:04 pm
by ale870
I tried it (on windows) and does not work. Furthermore on the documentation, there is "PLATFORM SUPPORT -> Mac". :-(

Posted: Wed Nov 11, 2009 3:37 pm
by Klaus
Hi ale870,

hmmmm, adjust the column width of "Platforms" OR read the complete description in the lower part of the doc window and you will be surprised :D

Posted: Wed Nov 11, 2009 3:57 pm
by ale870
Which version of RunRev are you using? I'm using V.4.0 and that function is available only for Mac.
I even tried to put the message handler in the card and in the stack, but that message is never trapped...

Posted: Wed Nov 11, 2009 4:25 pm
by malte
most likely the IDE is in the way. Try trapping newTool in a frontscript (and do not forget to pass it from there, which is what I suppose is happening)

All the best,

Malte

Posted: Wed Nov 11, 2009 6:40 pm
by Klaus
I am using Rev 4, see the screenshot of the docs, all platforms supported:
Image[/img]

Posted: Wed Nov 11, 2009 6:43 pm
by Klaus
Hi ale870
ale870 wrote:I tried it (on windows) and does not work...
Maybe the name of the parameter in SparkOuts script is a bit inconvenient (same as the handlers name!), try this one:

Code: Select all

on newTool theTool 
   if theTool is "Browse" then
      show stack "Editing Tools" 
   else
        hide stack "Editing Tools" 
   end if
end newTool 
Best

Klaus

Posted: Wed Nov 11, 2009 9:13 pm
by SparkOut
Well, I just copied and pasted the script out of the docs.

Anyway, I was sure that this had cropped up before somewhere, so I went hunting. Seems we all have a poor memory sometimes ;-)

http://forums.runrev.com/phpBB2/viewtop ... =9681#9681

The answer is that it does need to be put in a frontscript to be intercepted.

Posted: Wed Nov 11, 2009 10:06 pm
by ale870
Klaus wrote:I am using Rev 4, see the screenshot of the docs, all platforms supported:
Image[/img]
It's incredible! I have the same app and in my doc there is only Mac icon!!!
(tomorrow I will post a screenshot).
I have RunRev enterprise. It your screenshot of enterprise version or studio?

(tomorrow I will try to put the handler in the front-script).

Thank you!

Posted: Wed Nov 11, 2009 10:18 pm
by Klaus
I use the enterprise version.

Posted: Wed Nov 11, 2009 10:44 pm
by malte
Klaus, I think Metacard is a bit friendlier in this regard. At least up to Rev 3 (last time I tried) it indeed had to be in a frontscript, because the rev IDE does not pass it.

Cheers,

Malte