I have two windows both created in main. I need to disable the maximize button 
on the first window and disable the close button on the second window. I tried 
several things nothing seem to work for me. Any one know how, please give me 
some help.

I have played with the following code:



#include <FL/Fl_Window.H>
#include <FL/Fl.H>
#include <FL/x.H>
#include <windows.h>
#include <cstdlib>                  //for exit(0)


// Callback of the window menu-close button
void paramwin_cb(Fl_Widget *o, void *) {
    exit(0);
}


int main(int argc, char** argv)
{
  Fl_Window win(100,100,200,400);
  win.begin();
  win.callback(paramwin_cb);
  win.end();
  win.show(argc, argv);

  HWND hw1 = fl_xid(&win);
  SetClassLong(hw1,GCL_STYLE,GetClassLong(hw1,GCL_STYLE));
  SetWindowLong(hw1,GWL_STYLE,GetWindowLong(hw1,GWL_STYLE)&~WS_MAXIMIZEBOX);
  SendMessage(hw1,WM_NCPAINT,0,0);

  Fl_Window w(350,100,200,400);
  w.show(argc, argv);
  HWND hw2 = fl_xid(&w);
  SetClassLong(hw2,GCL_STYLE,GetClassLong(hw2,GCL_STYLE)|CS_NOCLOSE);
  SetWindowLong(hw2,GWL_STYLE,GetWindowLong(hw2,GWL_STYLE)|WS_MAXIMIZEBOX);
  SendMessage(hw2,WM_NCPAINT,0,0); //redraw window and border

  return Fl::run();
}


Kim



> Adding this will remove the minimize and maximize options too.
> > int main(int argc, char** argv) {
> > =A0Fl_Window w(200,400);
> > =A0w.show(argc, argv);
> > =A0HWND hw =3D fl_xid(&w);
> > =A0SetClassLong(hw,GCL_STYLE,GetClassLong(hw,GCL_STYLE)|CS_NOCLOSE);
>   SetWindowLong(hw,GWL_STYLE,GetWindowLong(hw,GWL_STYLE)&~WS_MINIMIZEBOX);
> > =A0SendMessage(hw,WM_NCPAINT,0,0); //redraw window and border
> > =A0return Fl::run();
> > }
>
> I would expect that to do something similar on X, you would use the
> hints described here:
> http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2551927
>

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

Reply via email to