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ā€™eĢcran 2023-01-22 aĢ€ 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: