popup menu on the mac. Items are disabled, and don't trigger events.

69 views
Skip to first unread message

Tony Kennedy

unread,
Sep 20, 2021, 12:32:45 PM9/20/21
to wx-users
Hi all,

I'm really struggling to get popup menus working on the Mac.

I've got a wxScrolled<wxPanel> and want a context menu when a user right clicks on something.

Issue 1. Every menu entry appears disabled. I found the link below, but the fix crashes in OSX Mojave.

Issue 2. If I use the function disableOSXMenuItemAutoEnabling in the link above, the menu items are not disabled. But they don't trigger any events either.

Is there a way of finding out the last clicked item in a wxMenu? If I knew that, I can work around everything.

Thanks in advance for any help.

Tony.

Vadim Zeitlin

unread,
Sep 20, 2021, 1:18:49 PM9/20/21
to wx-u...@googlegroups.com
On Mon, 20 Sep 2021 09:32:45 -0700 (PDT) Tony Kennedy wrote:

TK> I'm really struggling to get popup menus working on the Mac.

Sorry, you seem to assume that this is a well-known problem, but I don't
remember hearing about it before. Can it be reproduced in the menu sample
using the existing popup menu there? If not, what is different between your
menu and this one?

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

Tony Kennedy

unread,
Sep 20, 2021, 1:26:26 PM9/20/21
to wx-users
Thanks for the speedy reply.

I'm not really sure how to build the sample on the Mac. But happy to try. I've got to pop out, so will have a search when I get back to work out how to build.

Tony.

Vadim Zeitlin

unread,
Sep 20, 2021, 1:32:31 PM9/20/21
to wx-u...@googlegroups.com
On Mon, 20 Sep 2021 10:26:26 -0700 (PDT) Tony Kennedy wrote:

TK> I'm not really sure how to build the sample on the Mac. But happy to try.

Just run "make -C samples/menu" in the build directory, i.e. the one in
which you ran "configure && make" to build wxWidgets itself.

Tony Kennedy

unread,
Sep 20, 2021, 2:56:39 PM9/20/21
to wx-users
The sample works ok. I'll see if I can modify it so it more closely matches how I am trying to use it (tomorrow).
Message has been deleted

Tony Kennedy

unread,
Sep 20, 2021, 3:51:09 PM9/20/21
to wx-users
If I use the wxEVT_CONTEXT_MENU event, things trigger ok. I'll need to modify the rest of the code to use that function rather than the right click event.

Many thanks,

Tony.


Tony Kennedy

unread,
Sep 29, 2021, 5:07:28 AM9/29/21
to wx-users
I've ended up using a wxChoice in a modeless dialog to do this. No matter what I do, I cannot get the popup menu to work on MacOS. The context menu event is not really an option as I use the right click for other things as well.

Vadim Zeitlin

unread,
Sep 29, 2021, 10:10:41 AM9/29/21
to wx-u...@googlegroups.com
On Wed, 29 Sep 2021 02:07:28 -0700 (PDT) Tony Kennedy wrote:

TK> I've ended up using a wxChoice in a modeless dialog to do this. No matter
TK> what I do, I cannot get the popup menu to work on MacOS. The context menu
TK> event is not really an option as I use the right click for other things as
TK> well.

If you can reproduce the problem in the menu sample (or another sample, or
after making some simple changes to this sample and including a patch with
them), please open a ticket for this problem. Unfortunately there is not
much we can do without being able to reproduce it.

Tony Kennedy

unread,
Sep 29, 2021, 11:24:17 AM9/29/21
to wx-users
I understand the need to recreate the problem.

My problem is that sadly I'm not good enough at using Xcode to create a project from the sample that I can actually edit and build/debug. I find Xcode to be extremely difficult to work with.

Tony.



Vadim Zeitlin

unread,
Sep 29, 2021, 11:42:47 AM9/29/21
to wx-u...@googlegroups.com
On Wed, 29 Sep 2021 08:24:16 -0700 (PDT) Tony Kennedy wrote:

TK> My problem is that sadly I'm not good enough at using Xcode to create a
TK> project from the sample that I can actually edit and build/debug. I find
TK> Xcode to be extremely difficult to work with.

FWIW I'm in the same boat, so I build everything from command line under
Mac and use Xcode only for debugging -- or use lldb from the command line
for this too.

One advantage of reproducing the problem in a wx sample is that they're
easy to build (just "make -C $build_dir/samples/foo") and you can iterate
quickly because they're small (especially when using shared wx libraries,
otherwise relinking the program after every change still takes some time).
And you can use Xcode for debugging, even if you don't use it for building
(but you don't have to, neither).

Igor Korot

unread,
Sep 29, 2021, 11:59:34 AM9/29/21
to wx-u...@googlegroups.com
Hi, Tony,

On Wed, Sep 29, 2021 at 10:24 AM Tony Kennedy <kenned...@gmail.com> wrote:
>
> I understand the need to recreate the problem.
>
> My problem is that sadly I'm not good enough at using Xcode to create a project from the sample that I can actually edit and build/debug. I find Xcode to be extremely difficult to work with.

You can try to open the minimal.xcodeproj and just chage the source
code in the project.

Thank you.

>
> Tony.
>
>
>
> On Wednesday, 29 September 2021 at 15:10:41 UTC+1 Vadim Zeitlin wrote:
>>
>> On Wed, 29 Sep 2021 02:07:28 -0700 (PDT) Tony Kennedy wrote:
>>
>> TK> I've ended up using a wxChoice in a modeless dialog to do this. No matter
>> TK> what I do, I cannot get the popup menu to work on MacOS. The context menu
>> TK> event is not really an option as I use the right click for other things as
>> TK> well.
>>
>> If you can reproduce the problem in the menu sample (or another sample, or
>> after making some simple changes to this sample and including a patch with
>> them), please open a ticket for this problem. Unfortunately there is not
>> much we can do without being able to reproduce it.
>>
>> Regards,
>> VZ
>>
>> --
>> TT-Solutions: wxWidgets consultancy and technical support
>> http://www.tt-solutions.com/
>
> --
> Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
> ---
> You received this message because you are subscribed to the Google Groups "wx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/d1eac9f6-2136-46fa-b64c-a435f7b111efn%40googlegroups.com.

Tony Kennedy

unread,
Sep 29, 2021, 12:42:17 PM9/29/21
to wx-users
Typical, initially I could not even find this on my Mac :)

I'll see if I can get a demo using this.

Thanks for the suggestions.

Tony.


Tony Kennedy

unread,
Sep 29, 2021, 2:45:08 PM9/29/21
to wx-users
ok, I've modified the minimal sample, and things work. I guess the next step will be to modify the AUI sample (I'm using AUI in my app).

Tony.

Vadim Zeitlin

unread,
Sep 29, 2021, 3:09:22 PM9/29/21
to wx-u...@googlegroups.com
On Wed, 29 Sep 2021 11:45:08 -0700 (PDT) Tony Kennedy wrote:

TK> ok, I've modified the minimal sample, and things work. I guess the next
TK> step will be to modify the AUI sample (I'm using AUI in my app).

Anything is possible, but I really don't see how could using AUI change
anything here. There must be some other difference...
Reply all
Reply to author
Forward
0 new messages