TextField "modification" discrimination - Motif

This is a discussion on TextField "modification" discrimination - Motif ; I want / need to be able to use a TextField as both an input and an output field. As part of this requirement, I need to be able to write code that can distinguish between TextField "modification" as a ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: TextField "modification" discrimination

  1. TextField "modification" discrimination

    I want / need to be able to use a TextField as both an input and an
    output field. As part of this requirement, I need to be able to write
    code that can distinguish between TextField "modification" as a result
    of the USER TYPING IN THE FIELD, and as a result of the PROGRAM CALLING
    XmTextFieldSetString(). The "modify verify" and "value changed"
    callbacks are invoked in BOTH cases, and I don't know whether maybe I'm
    supposed to decode some kind of "callback reason" code somewhere, or
    discover user input (as opposed to programmatic modification) as a
    series of callbacks on "receive focus," "modify verify," "value
    changed," OR WHAT.

    Surely I can't be the only person in history ever to have had this
    question, yet I can't seem to find anything truly relevant on the Web.
    How is it done?

    Thanks,

    Chris


  2. Re: TextField "modification" discrimination

    Indeed you're not the only one, because the answer is in the doc verbatim.

    Where it talks about the info struct (XmTextVerifyCallbackStruct) passed
    to the callback --

    "event: Points to the XEvent that triggered the callback. It can be
    NULL. For example, changes made to the Text widget programmatically do
    not have an event that can be passed to the associated callback."

  3. Re: TextField "modification" discrimination

    Ah! Thank you! I KNEW it had to be something SIMPLE. Alas, I have
    always had a TERRIBLE time finding useful information in "the doc,"
    verbatim or otherwise. Thank you for bearing with me.

    Chris


  4. Re: TextField "modification" discrimination

    Ah! Thank you! I KNEW it had to be something SIMPLE. Alas, I have
    always had a TERRIBLE time finding useful information in "the doc,"
    verbatim or otherwise. Thank you for bearing with me.

    Chris


  5. Re: TextField "modification" discrimination

    Chris wrote:
    >
    > I want / need to be able to use a TextField as both an input and an
    > output field. As part of this requirement, I need to be able to write
    > code that can distinguish between TextField "modification" as a result
    > of the USER TYPING IN THE FIELD, and as a result of the PROGRAM CALLING
    > XmTextFieldSetString().



    What I do is have some global variable. The modification callback
    checks the variable. If it is set to 0, then it assumes it is a real
    user typing. If not, then it assumes that the program has made changes
    to the field and does nothing. In all cases, it resets the variable to
    0. So prior to calling XmTextFieldSetString, you just set the variable
    to 1.

+ Reply to Thread