# To subscribers of the xforms list from Trent Piepho <xyzzy@speakeasy.org> :
I want to have a button get the a shortcut of the delete key, but it doesn't
seem to work. It appears some keys can be assigned as shortcuts, and some
can't.
According the manual, page 222:
First a key is tested whether any object in the form has the key as a
shortcut. If affirmative, the first of those objects gets the
shortcut event.
Here is a test program which shows the behavior:
#include <forms.h>
int foo(FL_OBJECT *ob, int event, FL_Coord mx, FL_Coord my,
int key, void *raw_event)
{
if(event == FL_SHORTCUT)
printf("shortcut %d %s\n", key, XKeysymToString(key));
return !FL_PREEMPT;
}
int main(int argc, char *argv[])
{
FL_OBJECT *obj; FL_FORM *form;
fl_initialize(&argc, argv, 0, 0, 0);
form = fl_bgn_form(FL_NO_BOX, 80, 80);
obj = fl_add_button(FL_NORMAL_BUTTON,0,0,80,80,"Button");
fl_end_form();
fl_set_object_shortcutkey(obj, XK_Insert); /* works */
fl_set_object_shortcutkey(obj, XK_Delete); /* doesn't work */
fl_set_object_shortcutkey(obj, XK_BackSpace); /* doesn't work */
fl_set_object_shortcutkey(obj, XK_Control_L); /* doesn't work */
fl_set_object_shortcutkey(obj, XK_Up); /* works */
fl_set_object_shortcutkey(obj, XK_Tab); /* doesn't work */
fl_set_object_prehandler(obj, foo);
fl_show_form(form, FL_PLACE_FREE, FL_FULLBORDER, "test");
for(;;) fl_do_forms();
return 0;
}
_________________________________________________
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 : Mon Nov 13 2000 - 06:40:51 EST