# To subscribers of the xforms list from Steve Lamont <spl@ncmir.ucsd.edu> :
> 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");
fl_set_object_lalign(obj,FL_ALIGN_TOP);
fl_end_form();
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 );
fl_show_form(fd_try->try,FL_PLACE_CENTERFREE,FL_FULLBORDER,"try");
fl_do_forms();
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
0.89.
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.
spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Tue Jan 23 2001 - 16:44:55 EST