RectControl Contextual menu as a listbox

Greetings,

Is there a way to have a listbox on the contextual menu instead of the actual menu ? and if not then is there a way to create a custom control with this functionality ?
Or another option will be to allow multiple selection on the contextual menu in case we need to select more than one item to populate a listbox.

Thanks .

Prinicipally, almost everything is possible. If you want to avoid using declares or plug-ins, you can create a floating (modal) window that contains a listbox and position it appropriately when you catch the ConstructContextualMenu event.

On OS X natively, you might want to check some of Christian’s Cocoa examples where he simply creates a new NSView and fills it with content, or the overlay and popupviewcontroller examples. The same should be possible with MacOSLib, although I am not sure about its current 64Bit compatibility.

Use a listbox on a modal window.

Hello guys, that was indeed my second option as well but i taught that maybe i can make it other way more general.

The idea is having the control replace the setup in my previous post and i was thinking maybe by reading the docs it is possible to interact with the menu part but it seems not.

Ill look into this option and see how i can get it done in a nice, way, i was using a container control but the disadvantage there is that the controls dont get out of the container so if i have a small list it will stay there if i use the combo box model but with a listbox.

Thanks again.

In a way you could, maybe even with using MenuItems. I am a bit unsure about how easy it would be to maintain Menuitem behavior (which closes when an item is selected) with the ability to select several items. But you could probably override their behavior by tweaking the menuitems’ action handlers to a custom method that marks the selection in some property – and maybe checks for doubleclick or any other event that should now close the menu too.
If you should try and succeed, please keep me informed.

Any time we embark on inventing a new user interface element, there is a chance of completely loosing the user.

Seems to me the very nature of menus in both Mac and Windows is single selection. In each case, clicking an option closes the drop down. Doing something else, if even possible by some declare trickery, would be very unsettling for the user, and would not conform to Apple HIG and MS Windows Design Guidelines.

It is far better to display a ListBox on a small window, with multiple selection enabled, plus OK and Cancel buttons. And possibly a line of explanations. That way we stay in a familiar interface.

Full agreement. The GUI has become more graphical with custom icon buttons, different fonts and such, but the handling stays the same. I would be confused if a menuitem would persist after being clicked.

Well so far i know its not on the standards but it was actually the customer request so i have to see how it make it possible, so far with the modal dialog its quite messy the dialog is misbehaving and it has some funny graphics, issue, maybe because i`m trying more to have it like the current menu, the idea was to be able to have a big menu but to have the possibility to select multiple items and it will add them to the listbox when the mouse looses focus, then the list hides and stays like that until the user start to type in the search field , that causes the list to show again and to readjust according to the records found and again same usage but full list if you press the Button .

I tried to explain that it is not possible but they requested this so its quite messy and confusing but ill try to have something in an end.

By redrawing the window and resizing them all the time it will make the user go nuts but if they want like that i`ll try to do like that as much as i can.

Anyway i`ll keep you posted on how it goes

I’d use a regular window. When the user clicks outside (mouse looses focus) you’ll get a deactivate event where you can apply the selection and then hide or close the window.

To look prettier the windows titlebar can be hidden and the background drawn with a custom shape. This is basically making an NSPopover, like you showed in your screengrab. Are you using NSPopovers? That’d be the way to go.

[quote=246087:@Will Shank]I’d use a regular window. When the user clicks outside (mouse looses focus) you’ll get a deactivate event where you can apply the selection and then hide or close the window.

To look prettier the windows titlebar can be hidden and the background drawn with a custom shape. This is basically making an NSPopover, like you showed in your screengrab. Are you using NSPopovers? That’d be the way to go.[/quote]

Well i did not used that just the left popover retouched in photoshop and played with the image little bit, so i would love to use that NSPopovers but i have to read about them first and how to link them in xojo, so far i don`t remember of having that in the IDE.

That part with the windows i`m trying to do that, the challenge is to make it responsive to be similar to the menu, so if you play with the SearchField the list should grow or shrink according to the results, if that NSPopover will help having that wrapper to keep it steady and i will be able to play with the data then will do.

Thanks ill look into that part .

check https://forum.xojo.com/7533-popovers-my-solution/0

Thanks Michel , it seems that in my search i downloaded one project called SamNSPopover project and i`ve been tweaking that but it seems that there are some issues with the listbox, the issue is explained here, more showed .

Now im digging to see if its related to that particular project controls or a bug related to the Listbox .

I`ll keep the thread updated.

Thanks again.

Is it necessary for you to have the listbox inside a window? You can also have a hidden listbox, and populate and show it when needed. Occasionally I use this procedure, especially when no frame behind the listbox is needed. It disappears at mouse exit or row clicking or double clicking.
I’d add that I trigger listbox.visible thru a canvas.mousedown event; the canvas showing a small triangle.

Hello Carlo,

Not necessary, but still i want to keep it neath . the idea is to have something like this , the idea is to have a master listbox and a search listbox, once you select multiple records on the search listbox and exit the list on the mouse exit event it will put the selected rows on the master one.

[quote=246060:@Aurelian Negrea]Greetings,

Is there a way to have a listbox on the contextual menu instead of the actual menu ? and if not then is there a way to create a custom control with this functionality ?
Or another option will be to allow multiple selection on the contextual menu in case we need to select more than one item to populate a listbox.

Thanks .[/quote]

I did something like this without any Declares or Plug-In, just by using Containers, Textfields and a ListBox.

I just made a Container with a Canvas to Paint the Round Cornered Border and placed a TextField inside and on top of this Canvas. On the left end of this Canvas i placed a Magnifying Glas which the user can Click and then a Listbox will be populated and displayed like a Context Menu.

[quote=246511:@Sascha S]I did something like this without any Declares or Plug-In, just by using Containers, Textfields and a ListBox.

I just made a Container with a Canvas to Paint the Round Cornered Border and placed a TextField inside and on top of this Canvas. On the left end of this Canvas i placed a Magnifying Glas which the user can Click and then a Listbox will be populated and displayed like a Context Menu.

[/quote]

Nice one, you can do multiple select as well on that list or it is just to display the data ?

After all, it’s just a ListBox and you can do anything with it, you can do with any other ListBox. :slight_smile:
For my needs, i added a Codeline which removes the ListBox once an entry has been clicked.

well i`ll look into this as well, thanks