Re: XForms: Multiline Input: Cursor Positioning

From: Steve Lamont (
Date: Tue Jan 23 2001 - 20:43:27 EST

  • Next message: zaphodb: "Re: XForms: cygwin and X-server"

    # To subscribers of the xforms list from Steve Lamont <> :

    > After filling a multiline input field by fl_set_input(...)
    > the fl_set_input_cursorpos(...) instruction no longer works.

    Works for me with the following example code I banged together.

    #include <stdlib.h>
    #include "forms.h"

    /**** Forms and Objects ****/
    typedef struct {
            FL_FORM *try;
            void *vdata;
            char *cdata;
            long ldata;
            FL_OBJECT *input;
    } FD_try;

    FD_try *create_form_try(void)
      FL_OBJECT *obj;
      FD_try *fdui = (FD_try *) fl_calloc(1, sizeof(*fdui));

      fdui->try = fl_bgn_form(FL_NO_BOX, 250, 250);
      obj = fl_add_box(FL_FLAT_BOX,0,0,250,250,"");
      fdui->input = obj = fl_add_input(FL_MULTILINE_INPUT,20,30,220,210,"Input");

      fdui->try->fdui = fdui;

      return fdui;

    int main(int argc, char *argv[])
       FD_try *fd_try;

       fl_initialize(&argc, argv, 0, 0, 0);
       fd_try = create_form_try();

       fl_set_input( fd_try->input,
                     "line 1\n"
                     "line 2\n"
                     "line 3\n"
                     "line 4\n"
                     "line 5\n"
                     "line 6\n"
                     "line 7\n"
                     "line 8\n"
                     "line 9\n"
                     "line 10" );
       fl_set_input_cursorpos( fd_try->input, 5, 3 );

       return 0;


    > What ever you chose as x/y values in this routine the cursor is always
    > positioned at the end of the text and a check by
    > fl_get_input_cursorpos(ob,&x,&y) also gives the End of Text
    > coordinates (XForms Revision 0.86)

    Your version of XForms is *terribly* out of date. Current version is

    Note that if you call fl_set_input_cursorpos() *before* you call
    fl_set_input() the input position is set to the end of the last line
    of input. I'm not sure this is documented behavior but if you think
    about it, it makes some sort of sense, since fl_set_input() wipes out
    all the input and reloads it completely.

    To unsubscribe, send the message "unsubscribe" to or see
    XForms Home Page:
    List Archive:

    This archive was generated by hypermail 2b29 : Tue Jan 23 2001 - 16:44:55 EST