Hello.
I want to dynamically resize my widget, to make my label fit. But it doesn't 
work as expected. To demonstrate this I want to show you my example, maybe you 
can point me at my mistake:

#include <fltk/Window.h>
#include <fltk/Button.h>
#include <fltk/run.h>
#include <fltk/draw.h>

using namespace fltk;

int main(int argc, char **argv)
{
  Window *window = new Window(300, 180);
  window->begin();
    Widget *box = new Widget(20, 20, 260, 80, "Temp");

    box->box(UP_BOX);
    box->labelsize(36);
    box->labeltype(SHADOW_LABEL);
    box->align(fltk::ALIGN_LEFT | fltk::ALIGN_TOP | fltk::ALIGN_INSIDE | 
fltk::ALIGN_WRAP);
  window->end();

  window->resizable(box);
  window->show(argc, argv); // if I put this line after box->resize(...) 
everything works.

  int width  = box->w(),
      height = box->h() / 2; // possible height of Temp word

  box->resize(width, height);

  return run();
}
as you see from my comment, I don't know why I can't resize my widget when it 
is already displayed. I tried to use damage(), relayout(), flush()... and 
nothing works.
Thank you for your attention.
ps. I program under Ubuntu 7.04 and use fltk-2.0.x.r5966
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to