> 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?
Yes, you need to read up on how the resizables work in fltk!
It's a clever system, but a lot of folk find it tricky and/or
counterintuitive at first. There are some FAQ's and HowTo's about it on
the website, mainly about fltk-1, but the rules are the same.
Here's a little worked example - sorry to all and sundry it is so long -
but I think it shows the effects you are asking about, and seems to work
for me.
---------------------------------------
#include <fltk/DoubleBufferWindow.h>
#include <fltk/Button.h>
#include <fltk/run.h>
#include <fltk/InvisibleBox.h>
static fltk::DoubleBufferWindow *main_win=(fltk::DoubleBufferWindow *)0;
static fltk::DoubleBufferWindow *pop_win=(fltk::DoubleBufferWindow *)0;
static fltk::Button *btn1=(fltk::Button *)0;
static fltk::Button *quit=(fltk::Button *)0;
static fltk::Button *bt_grow=(fltk::Button *)0;
static fltk::Button *bt_shrink=(fltk::Button *)0;
static fltk::Button *bt_close=(fltk::Button *)0;
static fltk::InvisibleBox *dummy_box=(fltk::InvisibleBox *)0;
static fltk::InvisibleBox *dummy_2=(fltk::InvisibleBox *)0;
static void cb_grow(fltk::Button*, void*) {
pop_win->resize(pop_win->w()+20, pop_win->h()+20);
}
static void cb_shrink(fltk::Button*, void*) {
pop_win->resize(pop_win->w()-20, pop_win->h()-20);
}
static void cb_close(fltk::Button*, void*) {
if(pop_win) pop_win->hide();
}
static void make_popwin(void) {
pop_win = new fltk::DoubleBufferWindow(309, 230, "Popup Win");
pop_win->begin();
bt_grow = new fltk::Button(21, 16, 63, 35, "Grow");
bt_grow->callback((fltk::Callback*)cb_grow);
bt_shrink = new fltk::Button(21, 52, 63, 35, "Shrink");
bt_shrink->callback((fltk::Callback*)cb_shrink);
bt_close = new fltk::Button(220, 175, 63, 35, "close");
bt_close->callback((fltk::Callback*)cb_close);
// This dummy box "eats" all the resizing for the popup win, thereby
keeping
// the buttons the same size.
dummy_2 = new fltk::InvisibleBox(190, 145, 25, 25);
pop_win->end();
pop_win->resizable(dummy_2);
pop_win->show();
}
static void cb_btn1(fltk::Button*, void*) {
if(pop_win) pop_win->show();
else make_popwin();
}
static void cb_quit(fltk::Button*, void*) {
if(pop_win) pop_win->hide();
main_win->hide();
}
int main (int argc, char **argv)
{
main_win = new fltk::DoubleBufferWindow(309, 230, "Main");
main_win->begin();
btn1 = new fltk::Button(21, 16, 63, 35, "Popup");
btn1->callback((fltk::Callback*)cb_btn1);
quit = new fltk::Button(220, 175, 63, 35, "quit");
quit->callback((fltk::Callback*)cb_quit);
// This dummy box "eats" all the resizing for the main win, thereby
keeping
// the buttons the same size.
dummy_box = new fltk::InvisibleBox(190, 145, 25, 25);
main_win->end();
main_win->resizable(dummy_box);
main_win->show(argc, argv);
return fltk::run();
}
/* end of file */
SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk