test/tabs

18 views
Skip to first unread message

holm.h...@gmail.com

unread,
Oct 30, 2020, 8:30:59 AM10/30/20
to fltk.general

Hello,

I need to hide() a group which is under a group.

That functionality should be in the test/tabs program:
      { Fl_Group* o = new Fl_Group(10, 60, 315, 235, "@fileprint  &print");
        o->tooltip("tab5 verifies if visibility requests are handled correctly");
        o->hide();

For me the tab do however show.

any suggestions ?

Best regards
Håvard

imm

unread,
Oct 30, 2020, 9:16:18 AM10/30/20
to general fltk
Without seeing more of the code, my best guess would be that you need
to trigger a redraw of the parent widget to get the hide to actually
affect the visible image...

Worth a shot anyway...

holm.h...@gmail.com

unread,
Oct 30, 2020, 1:24:17 PM10/30/20
to fltk.general
Hi Ian,
Not quite, please have a look at test/tabs.cxx for source code. Here, hide() is called before end();

Best regards

imm

unread,
Oct 30, 2020, 1:35:46 PM10/30/20
to general fltk
On Fri, 30 Oct 2020 at 17:24, holm.haavard wrote:
>
> Hi Ian,
> Not quite, please have a look at test/tabs.cxx for source code. Here, hide() is called before end();

Sorry Håvard, I think I have not understood the question you are asking...
Can you explain what it is you want to achieve, please?
Cheers..

holm.h...@gmail.com

unread,
Oct 30, 2020, 2:04:59 PM10/30/20
to fltk.general
Sorry for not beeing clear.

I have a FL_Tabs and several FL_Groups underneath (Just like "Label1", "tab2".. on the test/tabs example). One of these groups should hide/show due to a user selection. To test this out, I use the test/tabs.cxx code. I want to define the "print"-group, but still want to be able to hide it.
In the source code, there is already called a hide(); but it do not seem to have any effect.

Best regards Ian,
Håvard

Greg Ercolano

unread,
Oct 30, 2020, 3:00:25 PM10/30/20
to fltkg...@googlegroups.com
    Since Fl_Tabs uses the hide() / show() flag on the immediate child groups
    to make them show when a tab is clicked, I don't think setting hide() on
    the tab child groups will be effective, as Fl_Tabs will override it depending
    on which tab is clicked.

    If you want a tab not to show up at all, you probably have to remove() the
    group from the Fl_Tabs widget, and add() it back when you want it to show
    up again.

    But in the above you say it's a "group in a group", which I would think should
    work, as long as the group you're hiding is not the immediate child of Fl_Tabs.


Albrecht Schlosser

unread,
Oct 30, 2020, 5:56:15 PM10/30/20
to fltkg...@googlegroups.com
On 10/30/20 8:00 PM Greg Ercolano wrote:
> On 2020-10-30 05:30, holm.h...@gmail.com wrote:
>>
>> Hello,
>>
>> I need to hide() a group which is under a group.
>>
>> That functionality should be in the test/tabs program:
>>       { Fl_Group* o = new Fl_Group(10, 60, 315, 235, "@fileprint  &print");
>>         o->tooltip("tab5 verifies if visibility requests are handled correctly");
>>         o->hide();
>>
>> For me the tab do however show.
>>
>> any suggestions ?
>
>
>     Since Fl_Tabs uses the hide() / show() flag on the immediate child groups
>     to make them show when a tab is clicked, I don't think setting hide() on
>     the tab child groups will be effective, as Fl_Tabs will override it depending
>     on which tab is clicked.

Yep, that's the point I wanted to make as well. Setting hide() on all
included children is only an initialization.

I believe the OP would want to use the Fl_Tabs::value(Fl_Widget *)
method to establish the tab group being actively shown(), see:

https://www.fltk.org/doc-1.4/classFl__Tabs.html#a188bef71735c167e44af095ddd4922b6

"int Fl_Tabs::value(Fl_Widget *newvalue)

Sets the widget to become the current visible widget/tab.

Setting the value hides all other children, and makes this one visible,
if it is really a child."


The last part of the last sentence is important: the argument to
value(Fl_Widget *) must be one of the direct children (i.e. one of the
Fl_Groups) used in the Fl_Tabs widget.
Reply all
Reply to author
Forward
0 new messages