Dropdown with Multiple Selections?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Dropdown with Multiple Selections?
Hi all,
I would like to use a drop down menu style control that allows multiple selections. Is there a control that allows this? I've tried all of the 'menu' controls and none seem to be able to do this?
Thank you,
Jon
I would like to use a drop down menu style control that allows multiple selections. Is there a control that allows this? I've tried all of the 'menu' controls and none seem to be able to do this?
Thank you,
Jon
-
- Livecode Opensource Backer
- Posts: 9286
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dropdown with Multiple Selections?
Sounds a bit unlikely.
Although you could have a listField which stacks up menu selections . . .
- -
Although you could have a listField which stacks up menu selections . . .
- -
Code: Select all
on mouseDown
put the fontNames into me
sort lines of me ascending international
end mouseDown
on menuPick XXX
put 1 into LYNE
repeat until LYNE > 1000000
if line LYNE of fld "MyFontz" is empty then
put XXX into line LYNE of fld "MyFontz"
put 1000005 into LYNE
else
add 1 to LYNE
end if
end repeat
end menuPick
- Attachments
-
- MULTI-STOREY CAR PARK.livecode.zip
- Here's the stack.
- (6.04 KiB) Downloaded 114 times
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Dropdown with Multiple Selections?
I think Richmond is correct.
These sorts of gadgets are drawn by the OS, and are not designed for what you want. You need to kludge LC itself. I have not seen Richmonds stack, but I bet it warrants examination.
Craig
These sorts of gadgets are drawn by the OS, and are not designed for what you want. You need to kludge LC itself. I have not seen Richmonds stack, but I bet it warrants examination.
Craig
Re: Dropdown with Multiple Selections?
@ Mr. Cumbersome
What about just:
Best
Klaus
What about just:
Code: Select all
on menupick xxx
if fld "YourFonz" = EMPTY then
put xxx into fld "YourFonz"
else
put CR & xxx AFTER fld "YourFonz"
end if
end menupick
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 9286
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dropdown with Multiple Selections?
OK, @Mr Short, F*t and Ug**
Your code may be shorter, but it may also be more difficult for other coders to "unpack".
Also, as a person who has repaired a bailer with barbed wire . . .
- -
. . . I am interested in getting the job done, even if "only" with barbed wire.
So do not consider that you can do something in a shorter "more elegant" (highly subjective) way as
somehow virtuous.
As I very rarely program on my BBC Micro with 32 Kb RAM I do NOT always feels an urge
to program in a minimalistic, elegant way.
Also, as I pointed out elsewhere today,
most of my code samples are put together in 5-10 minute breaks between online ZOOM classes.
Your code may be shorter, but it may also be more difficult for other coders to "unpack".
Also, as a person who has repaired a bailer with barbed wire . . .
- -
. . . I am interested in getting the job done, even if "only" with barbed wire.
So do not consider that you can do something in a shorter "more elegant" (highly subjective) way as
somehow virtuous.
As I very rarely program on my BBC Micro with 32 Kb RAM I do NOT always feels an urge
to program in a minimalistic, elegant way.
Also, as I pointed out elsewhere today,
most of my code samples are put together in 5-10 minute breaks between online ZOOM classes.
Re: Dropdown with Multiple Selections?
I HIGHLY doubt that!richmond62 wrote: ↑Thu Mar 11, 2021 8:19 pmYour code may be shorter, but it may also be more difficult for other coders to "unpack".
-
- Livecode Opensource Backer
- Posts: 9286
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dropdown with Multiple Selections?
John Stuart Mill may have said to Herbert Spencer,I HIGHLY doubt that!
"I disagree with everything you say, but I will always support your right to say it."
Be eternally grateful you do not have to snatch coding "snacks" between teaching ZOOM classes.
-
Re: Dropdown with Multiple Selections?
As Richmond says above, a listField is the probably the easiest way to do this.
If you need more inspiration you can check out a quick comboBox replacement i put together as a group object (what Craig would no doubt call a 'kludge' ).
I wasn't happy with the default comboBox, as there was no 'type ahead' searching of values and no way for the user to add/remove values in runtime, no arrow key navigation, etc, so i rolled my own and it works very well (so far!). Basically it's a group consisting of a a text field, listField, popup and an invisible rect to hold it all together and resize the group easier in IDE.
The listField simulates the popup bit of the combobox.
You can probably modify this to whatever suits your needs - download it from my github here: skComboBox
Hope that helps
Stam
If you need more inspiration you can check out a quick comboBox replacement i put together as a group object (what Craig would no doubt call a 'kludge' ).
I wasn't happy with the default comboBox, as there was no 'type ahead' searching of values and no way for the user to add/remove values in runtime, no arrow key navigation, etc, so i rolled my own and it works very well (so far!). Basically it's a group consisting of a a text field, listField, popup and an invisible rect to hold it all together and resize the group easier in IDE.
The listField simulates the popup bit of the combobox.
You can probably modify this to whatever suits your needs - download it from my github here: skComboBox
Hope that helps
Stam
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Dropdown with Multiple Selections?
Klaus.
Only a kludge, like a listField made to look and act like such a list will work here.
Craig
how does this present a multi-line selectable list of menuItems?on menupick xxx
if fld "YourFonz" = EMPTY then
put xxx into fld "YourFonz"
else
put CR & xxx AFTER fld "YourFonz"
end if
end menupick
Only a kludge, like a listField made to look and act like such a list will work here.
Craig
-
- Livecode Opensource Backer
- Posts: 9286
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dropdown with Multiple Selections?
It doesn't.how does this present a multi-line selectable list of menuItems?
But the OP did not ask for that as far as I can see.
What I believe (and the OP should feel 100% free to correct me if I'm wrong)
is that the OP wanted the ability to make several selections from a drop-down menu.
My code (and Klaus's) allows an end-user to make multiple selections which are then stored in a listField.
Having the multiple selections listed now allows them to be acted on.
I cannot see this sort of thing being possible at all:
-
Re: Dropdown with Multiple Selections?
Wait.....what?richmond62 wrote: ↑Thu Mar 11, 2021 10:12 pmIt doesn't.how does this present a multi-line selectable list of menuItems?
But the OP did not ask for that as far as I can see.
What I believe (and the OP should feel 100% free to correct me if I'm wrong)
is that the OP wanted the ability to make several selections from a drop-down menu.
My code (and Klaus's) allows an end-user to make multiple selections which are then stored in a listField.
Having the mulitple selections listed now allows them to be acted on.
Anyway, I don't have any input on this other than to say I don't see how it would be accomplished short of grouping a button and list field, and setting the list field to expand/contract when done making selections.
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Dropdown with Multiple Selections?
I have no idea what youse guys are talking about.
How does any of this present a multi-line pullDown of menuItems, so that the user can select one or more of them?
What does this field "yourFonz" have to do with anything , except to append a single selection after its contents?
What is needed is a multi-line capable list field, preset to magically appear on mouseDown over and below an appropriately prepared button that looks like a pulldown.
What am I, or you, missing here?
Craig
How does any of this present a multi-line pullDown of menuItems, so that the user can select one or more of them?
What does this field "yourFonz" have to do with anything , except to append a single selection after its contents?
What is needed is a multi-line capable list field, preset to magically appear on mouseDown over and below an appropriately prepared button that looks like a pulldown.
What am I, or you, missing here?
Craig
Re: Dropdown with Multiple Selections?
Far as I can tell your not missing anything, that was what I just said up there heh.
Re: Dropdown with Multiple Selections?
I am not aware of multi-line selection from a drop-down (or similar) menu in any of the obvious OS, so wonder at the OP's desire to introduce such a thing here. On the other hand, multi-line selection in a field is commonplace.
What is the case here, the reasons to shift normal operating paradigms for users?
How to do it seems to me of only academic interest, perhaps not a type that should be touched, or perhaps we are going to revolutionise the thinking of Apple, Microsoft, and a million penguins.
What is the case here, the reasons to shift normal operating paradigms for users?
How to do it seems to me of only academic interest, perhaps not a type that should be touched, or perhaps we are going to revolutionise the thinking of Apple, Microsoft, and a million penguins.
Re: Dropdown with Multiple Selections?
Well, speaking just for me, just asking the question is good enough. It isn't like I think everything that comes out of Redmond is gold of the realm, the same goes for Apples guidelines. Even some parts of 'nix'en interfaces leave me wondering
So, if someone wants a purple headed oxern to pull their cart, who am I to question it ? I just start looking for purple headed oxern
So, if someone wants a purple headed oxern to pull their cart, who am I to question it ? I just start looking for purple headed oxern