Page 1 of 1

Set stack as menu bar issues

Posted: Sat Jan 28, 2017 6:50 am
by Xacto
I am creating a macOS program that has a standard apple os menubar that was created in Menu Bar Builder.

There is a script in the stack that will move the window by selecting the edges -- however, the window jumps a few pixels upward when you have the mouse down. If I delete the menubar entirely or de-select the "Set as stack Menu Bar" in the Menu Bar Builder it works smoothly and correctly.

Is this a bug or do I need to add something in the code to deal with this?

I have included an example file.

Thank you for the help :D

Re: Set stack as menu bar issues

Posted: Sat Jan 28, 2017 10:30 am
by jmburnod
Hi,
I understand mousedown of btn "moveWindows" should check if there is a menu "menubar" or not.
Unfortunately, i don't know yet how to do that but i'm sure some LiveCoders know it :D
From doc
"In LiveCode, the menus function always returns empty."

Code: Select all

on mouseDown
   put item 1 of the mouseLoc into sgLeftOffset
   put item 2 of the mouseLoc into sgTopOffset
   
   --•• pseudocode
   --    if there is a menu "menubar" then 
   --       subtract 20 from sgTopOffset
   --    end if
   
   put true into sgDragging
end mouseDown
Best regards
Jean-Marc

Re: Set stack as menu bar issues

Posted: Sat Jan 28, 2017 10:56 am
by jmburnod
I just found a way.
1.Create a new menu "myMenu" with an item "JustTest"
2. change mousedown of btn "moveWindow" like this:

Code: Select all

on mouseDown
   put item 1 of the mouseLoc into sgLeftOffset
   put item 2 of the mouseLoc into sgTopOffset
      if there is a menu "myMenu" then 
         subtract 20 from sgTopOffset
       end if
   put true into sgDragging
end mouseDown
It seems work

Re: Set stack as menu bar issues

Posted: Sat Jan 28, 2017 1:09 pm
by Xacto
That works!!!
Thank you so much.

Question... is there a logical reason why the window moves (jumps) in the first place or is this a bug?

Re: Set stack as menu bar issues

Posted: Sat Jan 28, 2017 4:19 pm
by jmburnod
Question... is there a logical reason why the window moves (jumps) in the first place or is this a bug?
Not realy a bug for me (we have solved it without changing source code of LiveCode).
Just an unexpected behavior
Jean-Marc

Re: Set stack as menu bar issues

Posted: Sat Jan 28, 2017 5:17 pm
by jacque
LiveCode menus are objects that take up room at the top of a card. On Windows, this is standard; menus appear at the top of each window. When the same stack is run on a Mac, LiveCode pushes the top portion of the card above the top border of the window, out of view. The body of the window shortens to accomodate only that portion of the card that contains the actual stack content. The card is still technically the same height, but the part of the height that contains the menu group is out of view.

The adjusted handler corrects for the difference between the top window frame and the actual top of the card.