Page 2 of 2

Re: How to select menuitem by script ?

Posted: Tue Oct 20, 2020 2:39 pm
by dunbarx
Here is a stack that has been rolled. Jean-Marc, is it what you intended?
PullDownGadget.livecode.zip
(1.08 KiB) Downloaded 42 times
Craig

Re: How to select menuitem by script ?

Posted: Tue Oct 20, 2020 5:41 pm
by jmburnod
Craig,
No, user must see menuitems list
No need answer dialog, just the same as my stack but simpler with a menu btn.
It is for help users to use tools of one app.
Jean-Marc

Re: How to select menuitem by script ?

Posted: Tue Oct 20, 2020 5:58 pm
by mwieder
Here's my attempt at dealing with pulldown, option, and combobox menu buttons.
The main code is in the stack script, and the mouseUp handlers in the buttons at the bottom are pretty minimal.

Re: How to select menuitem by script ?

Posted: Tue Oct 20, 2020 6:13 pm
by dunbarx
I guess I am just not understanding. All these examples indeed display the dropDown list. None of them, including mine, under script control hilite one of those visible items.

I do not believe it is possible, due to the "blocking" nature of an open menuItem list. One needs a kludge.

Richard had insight into the reasons we see it this way.

Craig

Re: How to select menuitem by script ?

Posted: Tue Oct 20, 2020 6:46 pm
by mwieder
Maybe it's an OS thing then because I'm seeing the option and combo boxes highlight the selection before closing.

[Update] Yep - just tried this on OSX and it's completely different. So much for cross-platform controls.

Re: How to select menuitem by script ?

Posted: Tue Oct 20, 2020 8:04 pm
by FourthWorld
mwieder wrote:
Tue Oct 20, 2020 6:46 pm
Maybe it's an OS thing then because I'm seeing the option and combo boxes highlight the selection before closing.

[Update] Yep - just tried this on OSX and it's completely different. So much for cross-platform controls.
When should a tools provider like LC embrace OS-native implementations, and when should they invest in reinventing OS-supplied routines in non-standard ways for conformity with other OSes?

I don't have a clear universal rubric to answer that question. But that's the question.

Re: How to select menuitem by script ?

Posted: Tue Oct 20, 2020 8:40 pm
by mwieder
I don't have a generic answer either, but that's not critical to this problem...

OSX option menus show up centered vertically on the current selection (menuHistory).
On linux the options show up as a list below the button.
Windows: dunno.
On linux the controls are not blocked and can still be manipulated.
On OSX clicking on a control blocks anything else from happening until it's clicked to close.

It's not specific to LiveCode, but the way the different operating systems treat the controls.
So I think LiveCode is actually doing the right thing here by not trying to override the OS, even though it makes life harder for us as aspiring cross-platform developers.

Re: How to select menuitem by script ?

Posted: Wed Oct 21, 2020 3:52 am
by dunbarx
I learned something, which is always nice.

If I needed to make a pulldown act that way I would simply kludge one together. There is no reason to fret over different OS's if a 15 minute gadget does all that is required, and likely more. LC trumps such limitations.

But it is very useful to know that different OS's act differently. In that sense, it is critical, when considering the "Develop here, publish everywhere" paradigm that one also "test everywhere".

Craig

Re: How to select menuitem by script ?

Posted: Wed Oct 21, 2020 7:02 am
by FourthWorld
Definitely test everywhere. Always. With anything running cross platform, even web pages.