FLTK logo

STR #1638

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File | SVN ⇄ GIT ]

STR #1638

Application:FLTK Library
Status:5 - New
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:3 - Applies to all machines and operating systems
Subsystem:Unassigned
Summary:MENU_STAYS_UP - very good and usefull idea!
Version:2.0-feature
Created By:Andrzej
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]

No files


Trouble Report Comments:

Post Text ]
Name/Time/Date Text  
 
#1 Andrzej
01:42 Mar 23, 2007
Hello,

in src/Menu_popup.cxx (fltk2 svn rev 5750)  lines 845 to 855
#if 0
        if (widget->flag(MENU_STAYS_UP) && (!p.menubar || p.level)) {
          p.widget->set_item(p.indexes, p.level);
          p.widget->execute(widget);
          Window* mw = p.menus[p.level];
          if (widget->type() == Item::RADIO) mw->redraw();
          else if (checkmark(widget)) mw->redraw(DAMAGE_CHILD);
          return 1;
        }
#endif
I would like to use such a feature, it is great idea.
Unfortunately when I defined additinal flag (MENU_STAYS_UP) in ftlk/flags.h nothing happend. No callback was called and (in case of Item::TOGGLE/RADIO) state didn't change.
When I made some basic changes in this file, fltk did the callback and changed state, but ONLY when the menu did exit_modal() - by pressing other Item without MENU_STAYS_UP flag...

How can I make this code working? I mean Item(with MENU_STAYS_UP flag) change its state and executes callback immediately, without hiding menu.

Best Regards,

--

Andrzej Kwecka
 
 
#2 sanel.z
12:12 Apr 09, 2007
I'm not sure how you defined flag, but following will work:
 * you already uncommented parts inside Menu_popup.cxx
 * in fltk/Flags.h add "MENU_STAYS_UP = 0x00020000," (it reuse LAYOUT_VERTICAL value, but last one is not used inside menu labels)
 * myitem->flags(myitem->flags()|MENU_STAYS_UP); (copies current flags, like alignement and etc.)

This should keep menu opened after myitem callback, but for other items will close it.
 
 
#3 Andrzej
22:03 Apr 11, 2007
> * you already uncommented parts inside Menu_popup.cxx
yes,
> * in fltk/Flags.h add "MENU_STAYS_UP = 0x00020000," (it reuse LAYOUT_VERTICAL value, but last one is not used inside menu labels)
yes,
> * myitem->flags(myitem->flags()|MENU_STAYS_UP); (copies current flags, like alignement and etc.)
I used myitem->set_flag(MENU_STAYS_UP)

the callback it self did execute, but in case of RADIO or TOGGLE Buttons they didn't change their state as they should.
i tried to fix it but the redraw routine occurs only when i move mouse, highlighting other menu item..
 
 
#4 sanel.z
10:09 Apr 12, 2007
Ok, here is working hack:

if (widget->flag(MENU_STAYS_UP) && (!p.menubar || p.level)) {
   p.widget->set_item(p.indexes, p.level);
   p.widget->execute(widget);
   Window* mw = p.menus[p.level];
   if(widget->type() == Item::RADIO)
      widget->setonly();
   else if(widget->type() == Item::TOGGLE)
      widget->invert_flag(STATE);
   mw->redraw(DAMAGE_CHILD);
   return 1;
}

Now should RADIO/TOGGLE buttons be redrawn correctly.
 
 
#5 Andrzej
10:59 Apr 12, 2007
> if(widget->type() == Item::RADIO)
>      widget->setonly();
>   else if(widget->type() == Item::TOGGLE)
>      widget->invert_flag(STATE);

ok i will try this one,
previously I tried
'p.widget->' instead of 'widget->'
and perhaps that's why it didn't work last time

thank you for your help,

Best
Andrzej
 
     

Return to Bugs & Features | Post Text | Post File ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.