RE: [fltk.general] bug? Fl_Group::color requires a box style. [General Use]

12 views
Skip to first unread message

MacArthur, Ian (Leonardo, UK)

unread,
Aug 11, 2016, 12:43:34 PM8/11/16
to fltkg...@googlegroups.com
> Fl_Group *group1 = new Fl_Group(10,35,200,200,"group1");
> group1->box(FL_BORDER_BOX);

> Fl_Button *b1 = new Fl_Button(201, 10,90,25,"Button A1");
> Fl_Button *b2 = new Fl_Button(50, 90,90,25,"Button A2");
> Fl_Button *b3 = new Fl_Button(50,120,90,25,"Button A3");

> group1->end();
> group1->color(0xff000000);

> In order for group1 to display as red, it also needs FL_BORDER_BOX set. I
> would have thought you could have a red group box without any border?


In order for the group to have a colour, it needs to have a box type set, but not necessarily FL_BORDER_BOX.
I expect that what you want is probably FL_FLAT_BOX in this case.

Note that the default box type for a group is FL_NO_BOX, which does not draw anything at all, and hence can not show any colour. This is because a group is very often just a container for other widgets and does not need to be drawn at all itself.

A group can also be set to a FRAME type, but again that would not show your colour, since it only draws the frame of the group but not the background (again because it is assumed that a group is only there to hold other widgets and will have no specific drawing needs.)



Selex ES Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

Spacen

unread,
Aug 12, 2016, 4:59:37 AM8/12/16
to fltk.general, ian.ma...@leonardocompany.com


On Thursday, 11 August 2016 17:43:34 UTC+1, MacArthur, Ian (Leonardo, UK) wrote:
>     Fl_Group *group1 = new Fl_Group(10,35,200,200,"group1");
>     group1->box(FL_BORDER_BOX);

>     Fl_Button *b1 = new Fl_Button(201, 10,90,25,"Button A1");
>     Fl_Button *b2 = new Fl_Button(50, 90,90,25,"Button A2");
>     Fl_Button *b3 = new Fl_Button(50,120,90,25,"Button A3");

>     group1->end();
>     group1->color(0xff000000);

> In order for group1 to display as red, it also needs FL_BORDER_BOX set. I
> would have thought you could have a red group box without any border?


In order for the group to have a colour, it needs to have a box type set, but not necessarily FL_BORDER_BOX.
I expect that what you want is probably FL_FLAT_BOX in this case.

Note that the default box type for a group is FL_NO_BOX, which does not draw anything at all, and hence can not show any colour. This is because a group is very often just a container for other widgets and does not need to be drawn at all itself.

A group can also be set to a FRAME type, but again that would not show your colour, since it only draws the frame of the group but not the background (again because it is assumed that a group is only there to hold other widgets and will have no specific drawing needs.)


Yes I understand, thank you. 
Reply all
Reply to author
Forward
0 new messages