Alvin wrote:
> Albrecht Schlosser wrote:
>> try
>>       wnd->resizable(wnd); // the window itself
>>       wnd->init_sizes(); // reset internal sizes array
>>
>> instead.
>>
>> Maybe you could/should also call wnd->size_range(...), but I don't know
>> without further analysis or testing.
> 
> Yes, that was the missing piece. After resizing the window (and temporarily
> unsetting the resizable widget), the window will only be resizable if
> size_range() is called. That function must do something else or make a
> needed WM call? I haven't looked at the source yet.

At least one thing is clear: Calling wnd->resize() after setting 
wnd->resizable(0) sets the window's size range to the new width and 
height (fix, no resizing). Setting the resizable() after this doesn't 
change the size range, AFAICS.

> I've attached a working example. It's a dumby app that contains some
> widgets. Just compile with:
> 
> $ fluid -c wndresize.fl
> $ fltk-config --compile wndresize.cxx

Yes, that works ;-)

Now I could see that you were right with setting the resizable(0) before 
resizing the window, not resizable(wnd) as I suggested, but you found that.

>> BTW.: _Currently_ (!) it's a bad idea to remove the resizable widget from
>> a group without calling init_sizes() (or even delete() it!), because there
>> seems to be a bug that the group or window doesn't adjust the sizes array
>> accordingly. I remember an STR filed for FLTK 2.0, but this is true for
>> 1.x as well (it's on my todo list).
> 
> 
> So, init_sizes() should be called after I (un)set the resizable widget (like
> I do in the example)?

In the current FLTK 1.x versions, yes. I think that there are some bugs 
with handling the resizable(), but I'll have to look at the sources and 
docs. Maybe setting the resizable _must_ call init_sizes() internally, 
just as it does when add()ing and remove()ing widgets, but I don't know 
yet ...

> The docs for size_range() do mention that the range is automatically
> determined by resizable(). Perhaps calling size_range() in the callback
> forces that algorithm to execute?

IMHO, the docs are not very clear about what really happens or is 
intended. We should check and improve this.

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

Reply via email to