Thanks Jiang,
I've tried your suggestions.
I tried using fluid to create a menubar of 2 item groups with different colors. 
Fluid does this:
ItemGroup* o = new ItemGroup(...);
o->color( somecolor);
which doesn't work. The itemgroup color is the menubar color.

I lokked into menu_item, but it appears to be a fltk-1.x class.  I'm learning 
fltk-2.

I've been continuing to read and experiment with styles.  I now know how to use 
syles in a class. The NamedStyle declaration and revert function definition 
need to be global, not a part of the class. The class then sets it's style with 
'style( my_style) in the constructor. If I create a different style for each 
itemgroup, it works. Unfortunately, the style colors can be set, but not 
recovered from the style.

The only other way I've come across to contoll/access itemgroup colors, is to 
copy the draw function from itemgroup.  This approach allows the class to hold 
the colors so that the user could access/change the colors.

I'm running Linux, and haven't tried either of these techniques on any other OS.
Quite a learning experience.

Thanks,
Marty

Jiang Yang <[EMAIL PROTECTED]> wrote: > Hello All,
> Just another newbie question....
> I'm trying to create a menubar of itemgroups.  I would like the itemgroups 
> and child items to have a separate color from the other itemgroups in the 
> menubar.  This would allow different colored itemgroups in the menubar to be 
> 'color coded' acording to the subject type. I've subclassed ItemGroup and 
> Item, but can't seem to integrate the Style stuff into the classes.
>
> I've tried using Styles, according to the source code.  I've tried using 
> Styles according to the previous posts on this list.  I've tried copying 
> 'draw' code from the source files. Nothing seems to work.  I can compile 
> without errors, but the desired colors don't appear in the subclassed 
> itemgroup or item.
>
> Can someone give me an esample of how to incorporate styles into a subclass?
>
> NamedStyle( ItemGroup::default_style);
> seems like it's supposed to create a new style, as a copy from an existing 
> style. But how do I make the desired changes and incorporate it into my 
> CIGroup subclass of ItemGroup?
>
> Revert( Style *s);
> appears to be the function for making changes to the new style.  Do I create 
> a class function
> CIGroup::revert() in my class?
>
> I've read the documentation, but am getting more confused as I go on.
>
> Please point me in the right direction.
>
> Thanks,
> Marty
>
>

there is a parameter in the menu_item class, and i think you can set the color 
through changing the last parameter.

Of course, I prefer to use FLUID to make these stuffs.

_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


       
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
 Play Sims Stories at Yahoo! Games. 
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to