Re: XForms: Question : Multiple Select List ??

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 3 Mar 99 12:00:06 PST

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> How can I select a field in the Multiple Select List and then
> select a second one, then I want to automatically select all fields
> inbetween the two fields I already selected included the two fields.
>
> I believe you can do this on Windows by hitting the Shift Key, can you
> do this in Xforms ?

You can emulate this with a little creative coding. For example:

void multi_browser_cb(FL_OBJECT *ob, long data)

{

FL_Coord x;
FL_Coord y;
unsigned keymask;
static int last_line = 0;
int this_line = fl_get_browser( ob );

fl_get_mouse( &x, &y, &keymask );

if ( ( keymask & ShiftMask ) &&
fl_isselected_browser_line( ob, this_line ) ) {

if ( last_line ) {

int a = this_line;
int b = last_line;

if ( a > b ) {

int swap = b;

b = a;
a = swap;

}
for ( ++a ; a < b; a++ )
fl_select_browser_line( ob, a );

} else
last_line = this_line;

} else if ( fl_isselected_browser_line( ob, this_line ) )
last_line = this_line;
else
last_line = 0;

}

Use fl_get_mouse() to get the current keymask, which will tell you
whether the Shift key is pressed.

There are probably several special cases which I haven't bothered to
code for but this should get you started.

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://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/