> Barry Branham wrote:
> >> Barry Branham wrote:
> >>> I'm trying to implement a sidebar that you can hide and show again.
> >>> I'm using fltk-2.0.x-r5864.
> >>>
> >>> To do that I hide the sidebar group, then resize the group on the left to 
> >>> have the full window width with position x==0.  The left group is the 
> >>> window resizeable. To make this happen I had to call 
> >>> Window->init_sizes().  Then to unhide (show) the sidebar again, I resize 
> >>> the left group to x==sidebar_width and w==(window->w()-sidebar_width).  
> >>> Again I call Window->init_sizes().
> >> That seems okay so far. Calling init_sizes() is the right way to go.
> >>
> >>> This works fine, but if I resize the main window after hiding the 
> >>> sidebar, then show the sidebar, it's width is changed.  If the window was 
> >>> widened, the sidebar is wider and vice versa.
> >> You didn't tell us, what "sidebar_width" is. A constant? Something you 
> >> calculate?
> >>
> >>> Am I doing something wrong or is this a bug?
> >>> I have an example program (a revision of the test/resizable program)
> >> Posting a short example program would be helpful.
> >>
> >
> > Thanks for your reply.  sidebar_width is a constant (95 in example).
> >
> > Here's the example program inline, don't see how to attach it.
> > I replaced the arrow buttons at the lower right in the original resizable 
> > program with a 'Show' button for showing the hidden sidebar.
> > You click the red 'X' to hide it.
>
> Sorry, I can't really help you more. I don't have FLTK 2.0 installed.
>
> However, I'd suggest that you also resize your sidebar in showCB:
>
>
> void showCB(fltk::Widget *w, void *g)
> {
>       ((fltk::Group *)g)->show();
>
>       ((fltk::Group *)g)->resize(0,0,95,win->h(); // *** added ***
>
>       bigbox->resize( 95, 25, win->w()-95, bigbox->h());
>       rbox->resize( 95, 150, rbox->w()-95, rbox->h());
>       win->init_sizes();
> }
>
> Maybe someone else with FLTK 2.0 can help.
>
> Albrecht

Thanks Albrecht!

Your easy solution worked.  I didn't think of it because I was fixated on 
figuring out why the hidden sidebar's size should change in the first place.  
Still wondering about that.

Barry

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to