Set stack as menu bar issues

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Xacto
Posts: 26
Joined: Thu Dec 15, 2016 1:34 am

Set stack as menu bar issues

Post by Xacto » Sat Jan 28, 2017 6:50 am

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
Attachments
MoveIssue.livecode.zip
(3.45 KiB) Downloaded 52 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2006
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Set stack as menu bar issues

Post by jmburnod » Sat Jan 28, 2017 10:30 am

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2006
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Set stack as menu bar issues

Post by jmburnod » Sat Jan 28, 2017 10:56 am

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

Xacto
Posts: 26
Joined: Thu Dec 15, 2016 1:34 am

Re: Set stack as menu bar issues

Post by Xacto » Sat Jan 28, 2017 1:09 pm

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?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2006
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Set stack as menu bar issues

Post by jmburnod » Sat Jan 28, 2017 4:19 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3984
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Set stack as menu bar issues

Post by jacque » Sat Jan 28, 2017 5:17 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Mac OS”