"You have to double click to select an item from the drop down with the mouse."
Well that didn't work! I tried to attach a little patch to this bug report, but kept getting the message "file empty", which it wasn't. So, I gave up and simply appended it to my "Additional Comments". That too turned out to be an error because all the '\n's are swallowed up! So, apologies for screwing up the bug report on bugzilla! Here is what I meant to say: John, I don't see the difficulty here. Why can't you register a callback function to a single click event as we usually do? See the test code below that does just that. I must be missing something obvious, but your very clever code in DropDown.C seems to be re-inventing xforms' wheels? Angus Index: src/frontends/xforms/DropDown.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/DropDown.C,v retrieving revision 1.3 diff -u -p -r1.3 DropDown.C --- src/frontends/xforms/DropDown.C 2001/12/20 15:11:51 1.3 +++ src/frontends/xforms/DropDown.C 2002/01/08 10:43:38 @@ -9,6 +9,7 @@ #include <config.h> #include "DropDown.h" +#include "xforms_helpers.h" #include <iostream> @@ -25,6 +26,19 @@ extern "C" int C_DropDownPeekEventCB(FL_ return d->peek(static_cast<XEvent*>(xev)); } + +// a test function: simply prints the contents of the selected browser line +// to screen. +extern "C" void C_SingleClickCB(FL_OBJECT * ob, long) +{ + if (!ob || ob->objclass != FL_BROWSER) + return; + + int const sel = fl_get_browser(ob); + string const line = getStringFromBrowser(ob, sel); + std::cerr << "C_SingleClickCB: " << line << std::endl; +} + DropDown::DropDown(LyXView * lv, FL_OBJECT * ob) : lv_(lv) @@ -33,6 +47,7 @@ DropDown::DropDown(LyXView * lv, FL_OBJE fl_add_box(FL_UP_BOX, 0, 0, ob->w, 100, ""); browser_ = fl_add_browser(FL_SELECT_BROWSER, 0, 0, ob->w, 100, ""); form_->u_vdata = this; + fl_set_object_callback(browser_, C_SingleClickCB, 0); fl_set_browser_dblclick_callback(browser_, C_DropDownCompletedCB, 0); fl_register_raw_callback(form_, KeyPressMask|ButtonPressMask, C_DropDownPeekEventCB); fl_end_form();