Getting focus into an xmTextWidget - Motif

This is a discussion on Getting focus into an xmTextWidget - Motif ; Hi, I am using a group of textwidgets - one of them will have keyboard focus (i.e. you can type in that widget) but the user sometimes clicks onto another widget to perform some action. How do I get the ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Getting focus into an xmTextWidget

  1. Getting focus into an xmTextWidget

    Hi,

    I am using a group of textwidgets - one of them will have keyboard
    focus (i.e. you can type in that widget) but the user sometimes clicks
    onto another widget to perform some action. How do I get the focus to
    automatically come back to the text widget ? I have done Internet
    searches and came across requestFocus() function but cannot get it to
    work - plus I cannot seem to find anything in any of my motif books.

    i.e. myTextWidget->requestFocus() does not work.

    Any help appreciated.

    Thanks,

    Sal


  2. Re: Getting focus into an xmTextWidget

    sallyroberts69@excite.com wrote:

    > Hi,
    >
    > I am using a group of textwidgets - one of them will have keyboard
    > focus (i.e. you can type in that widget) but the user sometimes clicks
    > onto another widget to perform some action. How do I get the focus to
    > automatically come back to the text widget ?
    >...


    If the widgets are all in the same shell (i.e., in the same top-level
    window) then see the section on input focus in the Motif FAQ. It will tell
    you about XmProcessTraversal which may well do what you want.

    If the widgets are in different shells, then the only way I have found to do
    it is with an X function such as XSetInputFocus (being careful to check
    that the window is viewable first, using XGetWindowAttributes, since the
    call will result in an X error otherwise). The FAQ warns against using the
    X focus functions, but I have not encountered any problems in my app. If
    there is a better way, I would be interested to know it.

    Regards,

    Rob.


  3. Re: Getting focus into an xmTextWidget

    sallyroberts69@excite.com wrote:
    > Hi,
    >
    > I am using a group of textwidgets - one of them will have keyboard
    > focus (i.e. you can type in that widget) but the user sometimes clicks
    > onto another widget to perform some action. How do I get the focus to
    > automatically come back to the text widget ?


    If the other widgets are not text widgets, but, for example
    PushButtons (which do not need keyboard focus), you can also
    set XmNtraversalOn to FALSE
    and your previous text widget will keep the keyboard focus.

    Dušan Peterc
    http://www.arahne.si

  4. Re: Getting focus into an xmTextWidget

    Many thanks


+ Reply to Thread