Problem with Menubar handling
David Burgun
dburgun at dsl.pipex.com
Wed Apr 20 07:51:19 EDT 2005
*****Opps! Many appoligies, I sent out the last mail without changing
the subject!*****
Hi,
I have a problem with menu bars:
If I use the following script in the Stack Script with the
preOpenStack message, I get problems, the memu bar does not seem to
get instansiated correct. If I use it in the Mouse Up Handler of a
button on the Stack, all works fine.
---------------------------------------------------------------
--
-- preOpenStack Handler
--
---------------------------------------------------------------
on mouseUp
local myStackFileName
local myStackShortName
local myMainMenuPathName
local myStatus
put the filename of this Stack into myStackFileName
put the short name of this Stack into myStackShortName
put replaceText(myStackFileName,myStackShortName,"MainMenu") into
myMainMenuPathName
start using stack myMainMenuPathName
--
-- Ok to use Functions in "MainMenu" now
--
start using stack myStackFileName
set the menubar of this stack to "GroupRectangleMenu"
set the destroyStack of this stack to true
set the cpSaveStackFlag of this stack to false
if the environment is not "development" then
set the location of this stack to the screenLoc
end if
end mouseUp
Here's how my App works:
I have a Stack called MainMenu.rev, this stack contains the default
Menu Bar for my app and also in the Stack Script, functions that are
used in other stacks of the same app.
Normally when being used as an App (or built as a standalone) the
sequence of events is as follows:
AppFolder/SpashScreenStack (or the Standalone) - this stack display a
splash screen and goes to Stack AppFolder/RunTime/MainMenu.rev
AppFolder/StackMainMenu.rev Setups up the Default Menu bar and then
goes to other stacks depending on which item is selected.
The problem is that under the IDE I want to be able to open one of
the other stacks, however since this stack may use funtions defined
in MainMenu.rev I want to make sure it's loaded and the Stack Script
is available for use.
I therefore came up with the following script.
I think that there are two problems, one in my code and one that may
be due to my code but causes the IDE to become unstable as a result.
I am trying to find the problem in my code (which seems to be message
I am using (preOpenStack), since it works when placed in a button.
The second problem seems to be related to when I use either put
"xxxx" or answer "xxxx" or use the debugger to try to find the
problem. If I do this then it looks like the menu bar gets changed
and code that accesses the Menubar object doesn't work (I get an
object not found error when trying to enable or disable items in the
menubar.
If anyone could give me some advice here, that would be really
helpful. Knowing the correct message to put the script onto would be
of help!!!
One specific questions I have is, does the line:
start using stack myMainMenuPathName
cause the preOpenStack, openStack etc. messages to be executed in the
Stack myMainMenuPathName???
Thanks a lot and All the Best
Dave
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list