GIDForums  

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Oct-2004, 18:23
jarod jarod is offline
New Member
 
Join Date: Oct 2004
Posts: 14
jarod is on a distinguished road

Fl_Choice drop-down question


Hi dsmith! thanks for the warm welcome! actually another problem of mine is how to keep the drop-down list or the "Fl_Choice" to remain exapanded by just clicking the drop-down button or pressing "TAB" until it gets the focus(). Right now the only way to do this is to press the spacebar or drag the widget in order to keep the "Menu_Item" expanded. And who would think of using a space bar in a drop-down list and dragging would be a lil bit "dragging" to the user. What I'm using right now is the version 1.1.4 and i admit that it's still kinda poor in terms of features and some functionalities. Well, i just hope that the next versions would consider these scenarios. More power to FLTK and to GIDForums!

PS: i think (hopefully) ver. 2.0 already supports the "Fl_Choice" menu item expansion by just clicking the drop-down button.
  #2  
Old 28-Oct-2004, 19:37
jarod jarod is offline
New Member
 
Join Date: Oct 2004
Posts: 14
jarod is on a distinguished road

Tab order


I have solved my problem on how to keep the Fl_Choice remain epanded by clicking the mouse once or when the widget gets the focus.

Here, I made a subclass of the Fl_Choice widget and added an additional ::handle()
CPP / C++ / C Code:
int My_Fl_Choice::handle(int event)
{
           const Fl_Menu_Item *v;
           switch(event)
           {
                case FL_RELEASE : if (Fl::visible_focus()) Fl::focus(this);     //this is for clicking the mouse once
                                  Fl::event_is_click(0);
                                  v = menu()->pulldown(x(), y(), w(), h(), mvalue(), this);  //HERE
                                        if (!v || v->submenu()) return 1;
                                        if (v != mvalue()) redraw();
                                        picked(v);
                                        return 1;
                case FL_FOCUS : goto HERE;                                      //this is for pressing the "TAB" key
                default : return Fl_Widget::handle(event);
        }
}


Sorry for the poor indentation, i can't manage to indent the codes but, its the code that matters!

Hope this would be useful for some! More power to this forums and to FLTK users!
Last edited by dsmith : 29-Oct-2004 at 08:49. Reason: Please use [c] & [/c] for syntax highlighting
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:05.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.