MacArthur, Ian (SELEX GALILEO, UK) schrieb:
>> I am not sure if this is a bug so first I will ask.
>> I have program 1. It hides the menuBar when pressing on F9
>> key and statusBar when pressing F10 key. Also when I hide one
>> of these widgets the tabsGroup gets resized. It does the job
>> right but when I change the window size it resizes the
>> tabsGroup as if the menuBar and statusBar must be drawn.
>
> I don't know for fltk-2, but for fltk-1.x, if you change the displayed
> widgets within a group (or group derived widget) then you really ought
> to call;
>
> my_group->init_sizes();
As Ian said, fltk2 is the same. Just call
windowMain->init_sizes();
at the end of cbXxxBarToggle(..).
>> Please, try to compile and check it. Tell me if it is a bug
>> or I am doing something wrong.
There is a focus lost when switching back from fullscreen here.
I think you dont need to hide and show widgets/windows when changing
internal layout. eg.:
if(fullScrState) {
//~ windowMain->hide();
windowMain->fullscreen_off(windowX, windowY, windowW, windowH);
//~ windowMain->show();
everything works fine without that. Same for the other callbacks. If you
think something has to get redrawn, use redraw().
Some other things:
1. You may want to declare
static bool statusBarState = true;
inside your callback, since there is no need to modify them from outside
(This wont pollute the global namespace)
2. Doing
if (statusBarState) {
windowMain->statusBar->hide();
//windowMain->tabsGroup->hide();
windowMain->tabsGroup->h(windowMain->tabsGroup->h() + ...);
//windowMain->tabsGroup->show();
//statusBarState = false;
} else if(!statusBarState) {
is unneccesary code. The second if statement is always true (and might
get removed from optimizer) Just drop that.
3. Toggling boolean state has to be done for both branches:
statusBarState = !statusBarState;
will keep all sane.
> As to whether you are doing anything wrong, I'd suggest that using
> fltk-2 when it is known to be unmaintained is potentially asking for
> troubles later! ;-)
You'll always come into trouble. But the source is with you.
Gombok
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk