Re: XForms: problem with the input box

gopinath Taget (gopinatht@hotmail.com)
Mon, 07 Sep 1998 21:48:10 PDT

# To subscribers of the xforms list from "gopinath Taget" <gopinatht@hotmail.com> :

hi,
i tried the post handler with the demo program inputall.c. but the
problem persists. is it possible to get a sample program on how exactly
the posthandler should be used?
thanks in advance
gopinath

This is a known bug, I believe.
>
>Here is a hack I developed to work around the problem. The code
>should be self-explanatory.
>
>Create a posthandler for your input object(s) as follows:
>
>int input_posthandler( FL_OBJECT *obj, int event, FL_Coord mx, FL_Coord
my,
> int key, void *xevent )
>
>{
>
> const char *current_text = fl_get_input( obj );
> int l_current_text = strlen( current_text );
> int textwidth = fl_get_string_width( obj->lstyle, obj->lsize,
> current_text, l_current_text );
>
> if ( textwidth > obj->w ) {
>
> int xpos;
> int ypos;
> int xoffset;
>
> fl_get_input_cursorpos( obj, &xpos, &ypos );
>
> xoffset = fl_get_string_width( obj->lstyle, obj->lsize,
> current_text, xpos );
> if ( xoffset < fl_get_input_xoffset( obj ) )
> fl_set_input_xoffset( obj, xoffset );
>
> }
> return !FL_PREEMPT;
>
>}
>
>If you have more than one Input object, you need only create one
>posthandler, since it carries no internal state and it should be
>usable by multiple objects simulataneously.
>
>Register it in the standard manner for all the inputs in your form:
>
> [...]
>
> fd_try = create_form_try();
>
> fl_set_object_posthandler( fd_try->input1, input_posthandler );
> fl_set_object_posthandler( fd_try->input2, input_posthandler );
> fl_set_object_posthandler( fd_try->input3, input_posthandler );
>
> fl_show_form(fd_try->try,FL_PLACE_CENTERFREE,FL_FULLBORDER,"try");
>
> [...]
>
> spl
>_________________________________________________
>To unsubscribe, send the message "unsubscribe" to
>xforms-request@bob.usuf2.usuhs.mil or see
>http://bob.usuf2.usuhs.mil/mailserv/xforms.html
>XForms Home Page: http://bragg.phys.uwm.edu/xforms
>List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/
>
>

______________________________________________________
Get Your Private, Free Email at /cgi-bin/exit-to?http://www.hotmail.com
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/