2 more menubar questions

Jan Schenkel janschenkel at yahoo.com
Thu Jan 2 14:59:01 EST 2003


--- Mark Swindell <mdswindell at charter.net> wrote:
> I have a couple of questions:  I'm using Revolution
> 1.1.1. using a Mac,
> system 9.1.
> 
> 1.  An approximately 4 pixel gray band has appeared
> at the top of my window
> when displaying a menubar group in the window ala
> Windows.  It never was
> there before, and it won't go away unless the
> menubar goes up top, ala the
> Mac scheme of menus.
> 
> Clicking on the gray brings up the card properties
> palette.  This, even
> though I have two background graphics extending -13
> pixels above the top of
> the window, and thus on top of the card layer.  I
> don't understand.  I've
> tried rearranging things and replacing the elements,
> but it persists.
> 

As I don't have a Mac at hand to test this, I'll go on
the assumption that it's auto-created to compensate
for the height of a menubar under Windows and how much
screen estate that would gobble up under Windows.
Mac menus are possibly a different height.

> 2.  This stack has two menus. When using the menu
> manager, I click the
> checkbox so that the menus be displayed in at the
> top of screen, ala Mac.
> The set menubars command is in a preopencard handler
> at the stack level.
> (if the number of this cd is 1 then set the menubar
> to "MainMenu")
> (if <other condition> then set the menubar to
> "MainMenu2")
> 
> However only one menubar will display up top, while
> the other appears in the
> window. The Set As Menubar in Mac OS checkbox does
> not stick for both menus,
> only one or the other.
> 

Again, I can't checkthis right away, but I may have a
workaround for you. Maybe it's a better tactic to have
a single Mac menubar-group, and adapt that on-the-fly.

on preOpenCard
  put the long ID of group "MacMenuBar" into tMacMenu
  -- determine which menubar to copy
  if the number of this cd is 1 then
    put the long ID of group "MenuBar1" into tMenuBar
  else if <other condition> then
    put the long ID of group "MenuBar2" into tMenuBar
  end if
  -- update the menuitems
  set the text of btn "File" of tMacMenu to \
      the text of btn "File" of tMenuBar
  set the text of btn "Edit" of tMacMenu to \
      the text of btn "Edit" of tMenuBar
  set the text of btn "Help" of tMacMenu to \
      the text of btn "Help" of tMenuBar
end preOpenCard

The only annoying part about that is that you'll have
to move the 'menuPick'-handler to the card script and
check the target there.

An alternate way I've been working with lately, is to
emulate the 'menuMessages' property used in HyperCard:

1) set the script of the menu button to:

on menuPick pWhich
  set the wholeMatches to true -- to get the right
line
  put lineOffset(pWHich,the text of me) into tItemNum
  put item tItemNum of the uMenuMessages of me \
      into tMenuMessage
  do tMenuMessage
end menuPick

2) add a new custom property 'uMenuMessages'

set the uMenuMessages of btn "File" to \
    "pNewFile,pOpenFile,pSave,pSaveAs,-,pQuit"

3) and handle those in the card/stack/mainstack script

4) now you can expand the 'preOpenCard' handler to:

on preOpenCard
  put the long ID of group "MacMenuBar" into tMacMenu
  -- determine which menubar to copy
  if the number of this cd is 1 then
    put the long ID of group "MenuBar1" into tMenuBar
  else if <other condition> then
    put the long ID of group "MenuBar2" into tMenuBar
  end if
  -- update the menuitems
  set the text of btn "File" of tMacMenu to \
      the text of btn "File" of tMenuBar
  set the text of btn "Edit" of tMacMenu to \
      the text of btn "Edit" of tMenuBar
  set the text of btn "Help" of tMacMenu to \
      the text of btn "Help" of tMenuBar
  -- update the menumessages
  set the uMenuMessages of btn "File" of tMacMenu to \
      the uMenuMessages of btn "File" of tMenuBar
  set the uMenuMessages of btn "Edit" of tMacMenu to \
      the uMenuMessages of btn "Edit" of tMenuBar
  set the uMenuMessages of btn "Help" of tMacMenu to \
      the uMenuMessages of btn "Help" of tMenuBar
end preOpenCard

Admittedly, not a straightforward approach, but it
ought to do the trick.

> Thanks for any help and clarification.
> 
> Mark

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the use-livecode mailing list