Scrolling Menu

J. Landman Gay jacque at hyperactivesw.com
Mon Mar 20 02:23:37 EDT 2017


On 3/19/17 10:03 PM, dunbarx via use-livecode wrote:
> I actually never tried using a stack as a menu. So I just did. But in both
> v6.7 and 8.1.3, if I create and name a new stack, add a single button to it,
> and set the "menuName" of the button to the stack name, as soon as I click
> on the button, LC crashes and quits.
>
> Was it something I said?

More like something you did. :) I think you put the engine into a loop. 
Back in the old MetaCard days, when I was just a tot and walked to 
school uphill both ways (in a blizzard,) this used to be the only way we 
could make menus. It's still the only way to build a menu that has real 
icons or other non-text elements.

In the menu stack, you put buttons that do stuff, usually in mouseDown 
or mouseUp handlers. Size the stack to about the width of a real system 
menu and make it just enclose its contents. The buttons should be 
edge-to-edge in a vertical column, no borders. Basically you are 
implementing a hand-made menu object. When the user clicks on the 
buttons in the stack, they do menu-like things, like calling a handler 
in the mainstack or whatever. (Your test stack doesn't need any button 
handlers if you're just testing the display.)

Now you need a way to to tell LC to display the stack menu, so you 
create a new button on the mainstack. That's the one that needs the 
menuName, so it knows which stack to draw. When the user clicks this 
mainstack button, it looks up its menuName, finds that stack, and 
displays it.

I wonder what the engine was thinking as it tried to menu-ify a stack 
that was holding the button in the stack that was calling itself to show 
the stack that was holding the button in the stack that was calling 
itself to...

Never mind. You'd think there'd be a recursion warning though.

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




More information about the use-livecode mailing list