Page 1 of 2
Code to make popup menu show options without clicking on it.
Posted: Mon Mar 20, 2023 6:56 pm
by CAsba
Hi,
I was trying to figure out how to write code for a popup menu to open - to show the menu options - when I came across a previous thread pertaining to it.
Code was given as
Code: Select all
click at the loc of btn "optionButton"
which I adapted to
Code: Select all
click at the loc of btn "popup menu1"
.
In the thread this was acclaimed to be the solution, but with me, the menu options were displayed only momentarily then disappeared, too quickly for the user to read them and click on a selection. I tried locking the screen but with no success.
Anyone got any ideas ?
v10.0(dp 4) : Windows 10
Re: Code to make popup menu show options without clicking on it.
Posted: Mon Mar 20, 2023 7:06 pm
by Klaus
Works here on my Mac!?
Maybe it will behave different on Windows?
P.S.
Tested with LC 9.6.9 rc2
Re: Code to make popup menu show options without clicking on it.
Posted: Mon Mar 20, 2023 8:56 pm
by dunbarx
CAsba.
There are indeed many threads on this forum about that topic, including things to do after it opens. Looking at your code, it seems fine.The menu should stay open, because there is no reason for it to close. That said, I am on a Mac, and expect sanity.
Craig
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 12:31 pm
by CAsba
I've spent a lot of time playing with this, changing the inspector settings and messing with the code, but cannot get the the menu options to stay visible. Perhaps I should mention that the options are long pieces of text, but they stay visible when I click the btn.
Anyone got any further ideas about this ?
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 2:06 pm
by dunbarx
CAsba.
I mad an option menu with several long lines of code, and remotely clicked at the loc of the button. All worked just fine.
Try this on a NEW stack with a standard button and an option button. Put this in the standard button script:
Code: Select all
on mouseUp
click at the loc of btn 2 --the option button
end mouseUp
Does that work?
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 2:36 pm
by CAsba
Hi Dunbarx,
Thanks for your interest.
O did exactly as you suggested..
Result ?
Just the same the options show for around one second, then disappear.
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 3:35 pm
by dunbarx
Hmmm.
You are on Windows, I see. Well, what do you expect?
Anyone else duplicate, or have even heard of this?
Craig
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 4:05 pm
by Cairoo
CAsba,
If it's a popup menu button, the following works on desktop platforms:
Code: Select all
popup btn "popup menu1" at the clickloc
and then the button itself doesn't need to be visible. I used the clickloc but you can specify any loc.
- Gerrie
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 4:06 pm
by SWEdeAndy
dunbarx wrote: ↑Wed Mar 22, 2023 3:35 pm
Anyone else duplicate, or have even heard of this?
It might be related to the general misbehaviour of popup buttons in Windows — that they do not pause the script to wait for user input (contrary to what the docs say and how it works on Mac).
I just ran into this issue the other day and found a bug report from 2017:
https://quality.livecode.com/show_bug.cgi?id=20695
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 6:08 pm
by CAsba
Hi Gerrie,
I tried
Code: Select all
popup btn "popup menu1" at the clickloc
and
Code: Select all
popup btn "popup menu1" at the loc "619,511"
but not even a glimpse of the options.
Thanks anyway.
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 6:13 pm
by dunbarx
Andy makes a great point, though I would modify it slightly to make the process seem more natural:
Code: Select all
popup btn "yourOptionButton" at the loc of btn "yourOptionButton"
Craig
Re: Code to make popup menu show options without clicking on it.
Posted: Wed Mar 22, 2023 9:59 pm
by Cairoo
CAsba wrote: ↑Wed Mar 22, 2023 6:08 pm
Hi Gerrie,
I tried
Code: Select all
popup btn "popup menu1" at the clickloc
and
Code: Select all
popup btn "popup menu1" at the loc "619,511"
but not even a glimpse of the options.
Thanks anyway.
If your popup menu button's name is not "popop menu1" then substitute "popop menu1" with the actual name of your popup menu button.
But if it still does not work, then good luck. It works on my Windows system.
Re: Code to make popup menu show options without clicking on it.
Posted: Thu Mar 23, 2023 12:59 am
by dunbarx
@Cairoo.
You have a Windows machine and the above gadgetry works OK?
@CAsba It is something in your machine. Have you tried restarting?
Craig
Re: Code to make popup menu show options without clicking on it.
Posted: Thu Mar 23, 2023 6:58 am
by Cairoo
@Craig,
Yes I have a Windows machine and the popup command works. We both came up with the same idea just a few minutes apart, but your button is named slightly better than mine.
- Gerrie
Re: Code to make popup menu show options without clicking on it.
Posted: Thu Mar 23, 2023 1:59 pm
by CAsba
Hi,
I tried re-starting, even de-cluttered the desktop, but the problem persists. Thanks anyway.