MacArthur, Ian (SELEX) (UK) wrote:
>> I want to resize a window when clicking on a button within 
>> it. I call resize(new_width, new_height) and the window 
>> resizes fine. But when I then manually drag the window with 
>> the mouse, it flips back and is drawn in its original size!
>> Is there some method I need to call, such as redraw?
>> I also tried changing the size using w() and h() directly, 
>> but that doesn't do anything. Why?
>> Any help much appreciated!
> 
> 
> Look at the example resize.cxx in the test folder - if you build that,
> does it work for you? 
> 
> Actually, I find I have to comment out the call fltk::warp_mouse(...) in
> that example to get it to build at all for me right now, but once I do
> that, the program builds, and the resize and move behaviour seems to be
> correct.
> 
> If that example works, it should give you a clue how to fix up your code
> to work as well.

Hi Ian,

I built the resize example, and it works fine. But my example still doesn't!
I use resize() just like in the example, with a very simple window.
The only difference I see is that the window I'm resizing is not the 
main window, but a popup window made on the fly. So in pseudo code

main {
    MyOwnClass* main_obj = new MyOwnClass();
    Window* main_win = new Window();
    main_obj->add(main_win);

    main_obj->main_win->show();
    return run();
}

void cb_fromMenuItemInMainWin() {
    Window* pop = new Window();
    Button* resize_but = new Button();
    resize_but->callback(cb_resize);
    pop->add(resize_but);
    pop->show();
}

void cb_resize() {
    Window* pop = o->window();
    pop->resize(pop->w(), pop->h() + 10);
}

Also, I would like the popup window to resize without the contents 
resizing with it (I want to add more contents). Any hints on that?
Thanks!

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

Reply via email to