>
> OK, I think I see...
>
> TBH, I don't think I’d use a Fl_Menu_Window for that, I think I'd
> probably start with a Fl_Menu_Button and rework that to my needs...
> Maybe.
>
> Though, in the case I remember doing something similar, ISTR that what
> I *actually* did was use an Fl_Browser for my "dropdown list", that I
> then populated with text strings "on the fly" as stuff was entered.
> The browser was show()/hide() to enact the "dropdown".
>
> I think that worked OK, though it was a while ago, and I can't find
> the code I wrote for it...
>
Meh, can't find my old code - here's a nasty hack to show the sort of thing I meant, though, just in case it is useful...
//
// Possible demo for a drop-down choice alternative
// fltk-config --compile dropdwon.cxx
//
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Browser.H>
//#include <stdio.h>
static Fl_Double_Window *main_win=(Fl_Double_Window *)0;
static Fl_Button *quit_bt=(Fl_Button *)0;
static Fl_Input *inp=(Fl_Input *)0;
static Fl_Browser *brows=(Fl_Browser *)0;
static void cb_inp(Fl_Input* o, void*) {
brows->show();
}
static void cb_brows(Fl_Browser* o, void*) {
int val = o->value();
inp->value(o->text(val));
o->hide();
}
static void cb_quit_bt(Fl_Button*, void*) {
main_win->hide();
}
int main(int argc, char **argv) {
main_win = new Fl_Double_Window(368, 333, "Drodown Test");
main_win->begin();
inp = new Fl_Input(115, 35, 150, 25, "Dropdown Input");
inp->callback((Fl_Callback*)cb_inp);
inp->when(FL_WHEN_CHANGED);
Fl_Box* bx = new Fl_Box(75, 125, 200, 25);
bx->box(FL_FLAT_BOX);
bx->color(FL_GREEN);
Fl_Input* ipt2 = new Fl_Input(75, 175, 200, 25);
brows = new Fl_Browser(inp->x(), inp->y() + 25, inp->w(), 175);
brows->type(FL_SELECT_BROWSER);
brows->box(FL_FLAT_BOX);
brows->callback((Fl_Callback*)cb_brows);
brows->hide();
// some sample entries in the dropdown list
for (int idx = 1; idx <= 18; ++idx) {
char line[32];
snprintf(line, 32, "Line %d", idx);
brows->add(line);
}
quit_bt = new Fl_Button(299, 303, 64, 26, "Quit");
quit_bt->callback((Fl_Callback*)cb_quit_bt);
main_win->end();
main_win->show(argc, argv);
return Fl::run();
} // main
// end of file