Page 1 of 4

Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 4:17 pm
by cmhjon
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 :)

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 4:25 pm
by richmond62
Sounds a bit unlikely.

Although you could have a listField which stacks up menu selections . . .

-
SShot 2021-03-11 at 18.14.55.png
-

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

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 7:54 pm
by dunbarx
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

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 8:09 pm
by Klaus
@ Mr. Cumbersome
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
8)


Best

Klaus

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 8:19 pm
by richmond62
OK, @Mr Short, F*t and Ug** 8)

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 . . .
-
bailer.jpeg
bailer.jpeg (10.9 KiB) Viewed 7423 times
-
. . . 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?

Posted: Thu Mar 11, 2021 8:28 pm
by Klaus
richmond62 wrote:
Thu Mar 11, 2021 8:19 pm
Your code may be shorter, but it may also be more difficult for other coders to "unpack".
I HIGHLY doubt that! :D

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 8:47 pm
by richmond62
I HIGHLY doubt that!
John Stuart Mill may have said to Herbert Spencer,
"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.
-
SShot 2021-03-11 at 21.48.58.png

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 9:11 pm
by stam
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

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 10:00 pm
by dunbarx
Klaus.
on menupick xxx
if fld "YourFonz" = EMPTY then
put xxx into fld "YourFonz"
else
put CR & xxx AFTER fld "YourFonz"
end if
end menupick
how does this present a multi-line selectable list of menuItems?

Only a kludge, like a listField made to look and act like such a list will work here.

Craig

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 10:12 pm
by richmond62
how does this present a multi-line selectable list of menuItems?
It doesn't.

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:
-
multiFantasy.jpg

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 10:24 pm
by bogs
richmond62 wrote:
Thu Mar 11, 2021 10:12 pm
how does this present a multi-line selectable list of menuItems?
It doesn't.

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.
Wait.....what? Image

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.

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 10:25 pm
by dunbarx
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

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 10:32 pm
by bogs
Far as I can tell your not missing anything, that was what I just said up there heh.

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 10:59 pm
by Davidv
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. :)

Re: Dropdown with Multiple Selections?

Posted: Thu Mar 11, 2021 11:04 pm
by bogs
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 :roll:

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 :twisted: