XmMessageBox and accelerators for the buttons - Motif

This is a discussion on XmMessageBox and accelerators for the buttons - Motif ; I have an XmMessageBox with three buttons. My problem is - I need short cuts for these buttons. I change the translations - but for this, the special gadget has to be focus. I define accelerators for the messagebox in ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: XmMessageBox and accelerators for the buttons

  1. XmMessageBox and accelerators for the buttons

    I have an XmMessageBox with three buttons.

    My problem is - I need short cuts for these buttons.

    I change the translations - but for this, the special gadget has to be
    focus.

    I define accelerators for the messagebox in the resource file:
    o : okCB()
    c : cancelCB()
    o : extraCB()

    to call my own functions okCB() ,,,.

    In the programm I install the accelerators of the messagebox
    in the three gadgets - but it does not work.


  2. Re: XmMessageBox and accelerators for the buttons


    "fiversen" wrote in message
    news:1162896549.381902.323520@e3g2000cwe.googlegro ups.com...
    >I have an XmMessageBox with three buttons.
    >
    > My problem is - I need short cuts for these buttons.
    >
    > I change the translations - but for this, the special gadget has to be
    > focus.
    >
    > I define accelerators for the messagebox in the resource file:
    > o : okCB()
    > c : cancelCB()
    > o : extraCB()
    >
    > to call my own functions okCB() ,,,.
    >
    > In the programm I install the accelerators of the messagebox
    > in the three gadgets - but it does not work.
    >


    For accelerators in a resource file, don't try to do it via
    translations/actions, jusst set the XmNaccelerator resource:
    ?*myDialog*OK.accelerator: o
    ?*myDialog*Cancel.accelerator: c

    where "myDialog" is the name you gave the XmMessageBox.

    I'm not sure what your 3rd line is supposed to be.
    Do you want tne accelerator "o" to call two
    callbacks (okCB and extraCB), or did you really mean to
    specify a different accelerator for extraCB?

    also, note that is usually a bad practice to use plain keys as
    accelerators. It is better to use something like"
    Ctrlo
    Otherwise, if your dialog contains any text fields, the user
    would not be able to enter the letter "o" or "c" in any
    of the text fields, since you are capturing them as
    accelerators.
    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project




  3. Re: XmMessageBox and accelerators for the buttons

    Hello,

    > >I have an XmMessageBox with three buttons.
    > >
    > > My problem is - I need short cuts for these buttons.
    > >

    >
    > For accelerators in a resource file, don't try to do it via
    > translations/actions, jusst set the XmNaccelerator resource:
    > ?*myDialog*OK.accelerator: o
    > ?*myDialog*Cancel.accelerator: c
    >
    > where "myDialog" is the name you gave the XmMessageBox.
    >
    > I'm not sure what your 3rd line is supposed to be.
    > Do you want tne accelerator "o" to call two
    > callbacks (okCB and extraCB), or did you really mean to
    > specify a different accelerator for extraCB?
    >
    > also, note that is usually a bad practice to use plain keys as
    > accelerators. It is better to use something like"
    > Ctrlo
    > Otherwise, if your dialog contains any text fields, the user
    > would not be able to enter the letter "o" or "c" in any
    > of the text fields, since you are capturing them as
    > accelerators.


    I make it in another way - I don't find your solution and
    in the programm the shortcuts have to be change
    at runtime (strange!).

    I add an KeyEventHandler to my messagebox:
    ....
    XtAddEventHandler(SysMessageDialog, KeyPressMask,
    False, keyEventHandler, (XtPointer)
    this);
    ....


    In the callback function,
    I look for the event and call the functions.


    void keyEventHandler(Widget widget, XtPointer clientData,
    XEvent * eventAdr, Boolean *cont)
    {
    ....
    }

    Thanks for replay.

    So long
    Frank Iversen


+ Reply to Thread