How is possible to disable an item in a DesktopPopupMenu

HI
I looking an example to enable or disable an item of a popupmenu I have build in code.

Any help is appreciate

Thanks

Remove all items and add only those that are to be selected?

In pure Xojo code, that’s not possible. If you have the MBS plugins, however, it’s feasible. Do you use them?

That would be against the human interface guidelines.

if you use ConstructContextualMenu
https://documentation.xojo.com/api/user_interface/desktop/desktoppopupmenu.html#desktoppopupmenu-constructcontextualmenu

set enable=false at DesktopMenuItem?
https://documentation.xojo.com/api/user_interface/desktop/desktopmenuitem.html

Then the users will have to right-click on the popup menu. Not intuitive.

You could also build a regular menu and show it in the MouseDown event, replacing the menu of the PopupMenu, but that also would be awkward, for several reason:
• positioning the menu would not be native (and the OS handles edge cases)
• the OS may add items in one kind of menu but not others
• both menus may have different behaviours (scrolling, use of shortcuts, etc).

Many users are expecting UI to look native.

1 Like

On the appointment making part of a software, I had a PopupMenu with the list of people who could receive visitors.

I was asked if it was possible to differentiate the people available on the day of the appointment from those “absent” (holidays, illness, not working that day).

At that time Xojo (2013) did not allow me (in native) neither to gray an entry nor to make it appear in red (for absent).

Too bad, I don’t remember what I did at the time…

it seems you can addrow as a desktopmenuitem, and not just as string
so create a desktopmenuitem, set it’s enabled property to false, then addrow it to the desktoppopup

if you want to change it’s enabled state, then remove the row, and addrowat with again a desktopmenuitem enabled or not

1 Like

hmmmm loving so much errors like this with no idea what they come from …
:rage:
Capture d’écran 2023-01-22 à 18.08.00

edit: seems to come from making a new project on a macos 10.13 system with xojo 2022r4…
and as it is not supported anymore, I’m stuck.
hopefully M2pro macbooks are almost out… time for a renew !

edit2: if I build the app then it launch fine… but no debug possible.

edit3: @xojo team : a simple error number with the error message would help so much …
@Paul_Lefebvre @Geoff_Perlman

Adding a DesktopMenuItem with the Enabled property false doesn’t seem to actually have an effect:

Screen Shot 2023-01-22 at 12.23.47

testpopup.xojo_xml_project

Shame, because that kind of a feature is something that would get me to move to DesktopPopupMenu.

4 Likes

I would consider this as a bug !

1 Like

i see that when accidentally having 32bit as a target on mac?

I can’t have 32bits macos compile option when on xojo 2022r4…
and I tried x86 64bits or universal it’s the same result.
I can debug web apps on my 10.13.6 and xojo 2022r4, but it seems desktop apps really need 10.14

I see this error as a generic error when the linker returns something bad. it still should benefit from some more details about the error…

It has been said in various places, even officially, that if you debug your app on a Mac OS earlier than 10.14, the “minimum OS version” field won’t apply (and the 10.14 minimum support isn’t applied) so you can debug there.

Yes, I think so.
I have report it as a bug.

You can do something like this :

if as popupmenu, you duplicate a desktop menu.
I have this in my app RealCADD.
A regular menu “Action” which can be called as a contextual popupmenu.
The popupmenu has the same disabled items than the regular menu.
In the “ConstructContexttualMenu” event, I call this popupmenu with :

Var popMenu As DeskTopMenuItem
popMenu = MenuAction.Clone
base = popMenu.PopUp

Perhaps, it is possible to do the same with an invisible DesktopMenu.
But I don’t know if it is exactly what you want.

Thank you.
But I believe that is better to have a “correct” framework to work with.
I thought the Xojo team need to have as targhet deliver a simple and complete to use framework, so the developer have to work only on the solving of job targhet and not on other questions.

A popup menu is allways a popupmenu on desktop, web, iOs, Android platform , why I need to think on where my application i running?
:wink: