Fabio Garbin wrote:

> Hi matthiasm,
> 
> Thanks for your help..
> 
> You are right Fl_Menubar don't set a type value.
> 
> I'm trying to create a dynamic menu, so I need to create just a Fl_Menubar
> object in window, but I don't know how confirm if a windows has a
> Fl_Menubar on it.
> 
> Thanks
> 
>>
>> On 06.05.2008, at 00:11, Fabio Garbin wrote:
>> > How Can I know if a window has a MenuBar ?
>> >
>> > Is there any method/function to do this ?
>>
>>
>> Are you referrring to an FLTZK menu bar? Those are generated as
>> children of the Window. You can loop throug the children and check for
>> the appropriated type(), although I am not sure if Fl_Menubar sets a
>> type.
>>
>> Some operating systems also prived menus attached to windows that
>> relate to desktop functionality (maximize window, etc.). FLTK has no
>> function to modify or access these kind of menus.
>>
>> ----
>> http://robowerk.com/
>>
>>

>From the 1.3 docs
(http://www.fltk.org/documentation.php/doc-1.3/Fl_Menu_Bar.html)

it appears that Fl_Menu_Bar is derived from Fl_Menu_ which, in turn, is
derived from Fl_Widget. Therefore, you could use dynamic_cast?

Something like (written on the fly - not tested):

for(int i = 0; i < wnd->children(); i++)
{
   Fl_Menu_Bar *menubar = dynamic_cast<Fl_Menu_Bar*>(wnd->child(i));

   if(menubar)
   {
      // child i is the menubar
   }
}

Does that work for you?
-- 
Alvin
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to