> I am looking for a standard method to toggle the insert / overwrite mode in
> a FL_NORMAL_INPUT box. It seems that the default mode is INSERT mode and I
> would like to change the mode to OVERWRITE mode.
This is something of a hack, but you could use an input filter:
int filter( FL_OBJECT *obj, const char *old, const char *new, int c )
{
int x;
int y;
int retval;
fl_get_input_cursorpos( obj, &x, &y );
if ( x > MAXSTRLEN )
retval = FL_INVALID;
else {
char *string = strdup( old );
string[x - 1] = c;
fl_set_input( obj, string );
fl_set_input_cursorpos( obj, x, y );
free( string );
retval = !FL_INVALID;
}
return retval;
}
[...]
fl_set_input_filter( fd_try->input, filter );
fl_set_input_maxchars( fd_try->input, MAXSTRLEN + 1 );
fl_set_input( fd_try->input, "abcdefgh" );
[...]
I just crufted this up quickly so there are probably a few dangling
loose ends -- particularly in how to deal with backspace/delete, since
a backspace/delete isn't reported to the input filter (IMHO, an
omission) so you may need to set FL_RETURN_ALWAYS and move this code
to the callback if you want backspace to leave a blank rather than
delete.
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/