Problem with selecting an option menu entry.

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
Problem with selecting an option menu entry.

Submitted by Anonymous (not verified) on

Fri, 06/15/2012 - 12:07

Hi all,
I have a little problem with option menus and I was hoping someone here could help me out. This is the problem:
I have an option menu which has a function attached to the XmNentryCallback. When the user selects a specific entry, this callback pops up a blocking warning/question dialog asking if the user really wants to continue.
If the user chooses to abort the action by clicking cancel on this dialog, I want to reset the option menu to the selection that it had prior to the users action (by setting the XmNmenuHistory value). This happens in the callback. While the function does as it's supposed to, motif or Xt or Xlib screw me over further on down the execution stack. The callback seems to be executed at the very top of the stack. My function correctly sets the option menu state, but after the callback is done,my option menu selection is overridden and instead the clicked button is made the active/current one.
After having analyzed the problem, my best guess is that the callback list is invoked BEFORE the button that was clicked is actually made the active one on the menu (by Xlib or Xt or motif). So while my function does as it's supposed to do, due to the execution order, my selection is simply overridden.
Can anyone tell me if this is possible/likely and if so, how I can override any further changes to the option menu? I could also live with completely disabling the option menus automatic selection as I always call my own update routine (which sets the XmNmenuHistory value).
Thanks in advance for your help.
‹ Column truncation in XmDETAIL Container Scrollbar ›

 

Mon, 02/13/2006 - 14:12#1

Mon, 02/13/2006 - 14:12#1

sparklehorse77

an ugly resolution....

Hi again,

I've managed to solve this problem with what I would call an ugly hack: I added a callback routine for each of the pushbuttons in the option menu. whenever a button is activated, the callback routine then again forces an update of the option menus.

it would probably be a cleaner method now to just ditch the XmNentryCallback list entirely... but for the time being, this does what I want.

Still, if someone happens to have a more elegant solution to the described problem, I'd appreciate any help.