the menuBar and the EditMenus

J. Landman Gay jacque at hyperactivesw.com
Sat Apr 12 20:37:55 CEST 2014


On 4/12/14, 7:35 AM, Graham Samuel wrote:
> suppose my cross-platform app was designed to emulate a TV screen
> (16:9 is the current ratio), how would that 'just work'?

The critical piece that isn't always clear is that the menu bar doesn't 
count as part of your display area; think of it in the same way as the 
window title bar. It does exist in the stack and takes up space there, 
but all content should be considered separately from that (it has to be, 
otherwise on Windows any objects above that will intersect with the 
menus.) To add a menu bar after the stack is already laid out, increase 
the height of the stack by the height of the menu group, move all your 
current content down that much, and put the menu bar group in the 
now-empty space at the top. The actual content area is still 16:9, and 
is the area below the menu group.

The menu builder tool will do the moving for you if you select the "set 
as stack menu bar" checkbox on a stack that doesn't have a menu 
assigned. Alternately you can use my "pushdown" handler to do it. First 
increase the height of the stack by the height of your menubar group. 
Then run this:

on pushDown tH,tY
   if tH = "" and tY = "" then
     ask "Enter horizontal and vertical offsets:" with "0,38"
     if it = "" then exit pushDown
     put item 1 of it into tH
     put item 2 of it into tY
   end if
   if tH = "" then put 0 into tH
   if tY = "" then put 0 into tY
   set cursor to watch
   repeat with x = 1 to the number of bgs
     set the left of bg x to the left of bg x + value(tH)
     set the top of bg x to the top of bg x + value(tY)
   end repeat
   repeat with x = 1 to the number of cds
     go cd x
     repeat with n = 1 to the number of cd controls
       set the left of cd control n to the left of cd control n + value(tH)
       set the top of cd control n to the top of cd control n + value(tY)
     end repeat
   end repeat
end pushDown

Call it from the message box this way:

   pushdown 0,27

If the menu is already in place, the handler will move it down with 
everything else so you'll have to drag it back up to the top. When 
that's done, you'll see that the actual display area is still the same 
proportions as before. On a Windows machine the menu will be in the 
stack window as required, and the ratio of the actual content area below 
it will be 16:9. On a Mac, the menu will scroll up out of view but the 
visible area will still be 16:9.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list