Xt : Having 2 input with the same value - Xwindows

This is a discussion on Xt : Having 2 input with the same value - Xwindows ; Hello, this is my first post on this group. I have to design a GUI based on X, and I dont't know X librairies (Xaw) very well. I have two inputs in my GUI. The goal is to have the ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Xt : Having 2 input with the same value

  1. Xt : Having 2 input with the same value

    Hello, this is my first post on this group.

    I have to design a GUI based on X, and I dont't know X librairies (Xaw)
    very well.

    I have two inputs in my GUI. The goal is to have the same values in
    these inputs. it mean that if you set a value in the input1, the same
    value should appear in the input2.

    Here are my inputs :

    ib_start = XtVaCreateManagedWidget (
    "Start ",
    dialogWidgetClass, // Widget-Class
    w_input_box, // Parent-Widget
    XtNwidth, (XtArgVal) 250,
    XtNvalue, (XtArgVal) "",
    XtNlabel, (XtArgVal) "Start file ",
    NULL);


    ib_end = XtVaCreateManagedWidget (
    "End ",
    dialogWidgetClass, // Widget-Class
    w_input_box, // Parent-Widget
    XtNwidth, (XtArgVal) 250,
    XtNvalue, (XtArgVal) "",
    XtNlabel, (XtArgVal) "End file ",
    XtNfromVert,ib_start,
    NULL);

    and here is the function that should be called :

    static void action_Update_Values (Widget w, XtPointer client_data,
    XtPointer call_data)
    {
    XtVaSetValues (ib_end, XtNvalue, XawDialogGetValueString
    (ib_start) , NULL);
    }


    Do you know how can I call the function action_Update_Values when the
    input value of ib_start is changed ?


    Thank you very much for your help.
    Nicolas.


  2. Re: Xt : Having 2 input with the same value

    slogandepub@free.fr wrote:
    > Hello, this is my first post on this group.
    >
    > I have to design a GUI based on X, and I dont't know X librairies (Xaw)
    > very well.
    >
    > I have two inputs in my GUI. The goal is to have the same values in
    > these inputs. it mean that if you set a value in the input1, the same
    > value should appear in the input2.
    >
    > Here are my inputs :
    >
    > ib_start = XtVaCreateManagedWidget (
    > "Start ",
    > dialogWidgetClass, // Widget-Class
    > w_input_box, // Parent-Widget
    > XtNwidth, (XtArgVal) 250,
    > XtNvalue, (XtArgVal) "",
    > XtNlabel, (XtArgVal) "Start file ",
    > NULL);
    >
    >
    > ib_end = XtVaCreateManagedWidget (
    > "End ",
    > dialogWidgetClass, // Widget-Class
    > w_input_box, // Parent-Widget
    > XtNwidth, (XtArgVal) 250,
    > XtNvalue, (XtArgVal) "",
    > XtNlabel, (XtArgVal) "End file ",
    > XtNfromVert,ib_start,
    > NULL);
    >
    > and here is the function that should be called :
    >
    > static void action_Update_Values (Widget w, XtPointer client_data,
    > XtPointer call_data)
    > {
    > XtVaSetValues (ib_end, XtNvalue, XawDialogGetValueString
    > (ib_start) , NULL);
    > }
    >
    >
    > Do you know how can I call the function action_Update_Values when the
    > input value of ib_start is changed ?


    As far as I know you must use XawDialogAddButton to add an "ok"
    button and register a callback function to be called. Another option
    is to register an action handler for the Return key. Take a look at

    http://www.perchine.com/dyp/x/online/popup.c

    That program implements both solutions simultaneously.

    BTW, if you want to program using the X Toolkit then I'd suggest you
    to use Motif instead of Xaw.

    --- Casantos


  3. Re: Xt : Having 2 input with the same value

    Thank you for your suggestion, but unfortunately the solution you
    proposed doesn't feet to my project.

    What I need is to have a Callback when a keyboard touch is pressed in
    input box.

    Does someone knows how to do that ?

    Thank you in advance.


    nojunk@gate.cpmet.ufpel.tche.br a écrit :

    > slogandepub@free.fr wrote:
    > > Hello, this is my first post on this group.
    > >
    > > I have to design a GUI based on X, and I dont't know X librairies (Xaw)
    > > very well.
    > >
    > > I have two inputs in my GUI. The goal is to have the same values in
    > > these inputs. it mean that if you set a value in the input1, the same
    > > value should appear in the input2.
    > >
    > > Here are my inputs :
    > >
    > > ib_start = XtVaCreateManagedWidget (
    > > "Start ",
    > > dialogWidgetClass, // Widget-Class
    > > w_input_box, // Parent-Widget
    > > XtNwidth, (XtArgVal) 250,
    > > XtNvalue, (XtArgVal) "",
    > > XtNlabel, (XtArgVal) "Start file ",
    > > NULL);
    > >
    > >
    > > ib_end = XtVaCreateManagedWidget (
    > > "End ",
    > > dialogWidgetClass, // Widget-Class
    > > w_input_box, // Parent-Widget
    > > XtNwidth, (XtArgVal) 250,
    > > XtNvalue, (XtArgVal) "",
    > > XtNlabel, (XtArgVal) "End file ",
    > > XtNfromVert,ib_start,
    > > NULL);
    > >
    > > and here is the function that should be called :
    > >
    > > static void action_Update_Values (Widget w, XtPointer client_data,
    > > XtPointer call_data)
    > > {
    > > XtVaSetValues (ib_end, XtNvalue, XawDialogGetValueString
    > > (ib_start) , NULL);
    > > }
    > >
    > >
    > > Do you know how can I call the function action_Update_Values when the
    > > input value of ib_start is changed ?

    >
    > As far as I know you must use XawDialogAddButton to add an "ok"
    > button and register a callback function to be called. Another option
    > is to register an action handler for the Return key. Take a look at
    >
    > http://www.perchine.com/dyp/x/online/popup.c
    >
    > That program implements both solutions simultaneously.
    >
    > BTW, if you want to program using the X Toolkit then I'd suggest you
    > to use Motif instead of Xaw.
    >
    > --- Casantos



  4. Re: Having 2 input with the same value


    wrote in message
    news:1153494946.993730.154310@s13g2000cwa.googlegr oups.com...
    > Hello, this is my first post on this group.
    >
    > I have to design a GUI based on X, and I dont't know X librairies (Xaw)
    > very well.
    >
    > I have two inputs in my GUI. The goal is to have the same values in
    > these inputs. it mean that if you set a value in the input1, the same
    > value should appear in the input2.
    >
    > Here are my inputs :
    >
    > ib_start = XtVaCreateManagedWidget (
    > "Start ",
    > dialogWidgetClass, // Widget-Class
    > w_input_box, // Parent-Widget
    > XtNwidth, (XtArgVal) 250,
    > XtNvalue, (XtArgVal) "",
    > XtNlabel, (XtArgVal) "Start file ",
    > NULL);
    >
    > ib_end = XtVaCreateManagedWidget (
    > "End ",
    > dialogWidgetClass, // Widget-Class
    > w_input_box, // Parent-Widget
    > XtNwidth, (XtArgVal) 250,
    > XtNvalue, (XtArgVal) "",
    > XtNlabel, (XtArgVal) "End file ",
    > XtNfromVert,ib_start,
    > NULL);
    >



    The XtNfromVert resource is useless here - it is a constraint resource
    placed on
    children of a dialogWidget, not on the dialogWidget itself.

    > and here is the function that should be called :
    >
    > static void action_Update_Values (Widget w, XtPointer client_data,
    > XtPointer call_data)
    > {
    > XtVaSetValues (ib_end, XtNvalue, XawDialogGetValueString
    > (ib_start) , NULL);
    > }
    >
    >
    > Do you know how can I call the function action_Update_Values when the
    > input value of ib_start is changed ?
    >
    >
    > Thank you very much for your help.
    > Nicolas.
    >


    As Casantos has already mentioned, you should use Motif widgets, not Athena
    widgets.

    When using the XAW dilaog widget the way you want to, you need to get the
    value widget child (it is an asciiText widget), and add the appropriate
    callback to that widget.



+ Reply to Thread