Message to detect BROWSE/EDITOR switching?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Message to detect BROWSE/EDITOR switching?

Post by ale870 » Wed Nov 11, 2009 11:38 am

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!

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Nov 11, 2009 12:04 pm

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

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Post by ale870 » Wed Nov 11, 2009 1:30 pm

Thank you! That's I was looking for!

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Nov 11, 2009 2:57 pm

ale870,

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

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Post by ale870 » Wed Nov 11, 2009 3:04 pm

I tried it (on windows) and does not work. Furthermore on the documentation, there is "PLATFORM SUPPORT -> Mac". :-(

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Nov 11, 2009 3:37 pm

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

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Post by ale870 » Wed Nov 11, 2009 3:57 pm

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...

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Wed Nov 11, 2009 4:25 pm

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

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Nov 11, 2009 6:40 pm

I am using Rev 4, see the screenshot of the docs, all platforms supported:
Image[/img]

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Nov 11, 2009 6:43 pm

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

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Nov 11, 2009 9:13 pm

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.

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Post by ale870 » Wed Nov 11, 2009 10:06 pm

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!

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Nov 11, 2009 10:18 pm

I use the enterprise version.

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Wed Nov 11, 2009 10:44 pm

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

Post Reply