Brett,
a minimum size is easy to enforce on a toplevel window like TGMainFrame
or TGTransientFrame via the TGMainFrame::SetWMSizeHints(), where you can
specify the minimum and maximum size a window can be resized to, also the
resize increments can be specified.
-- Fons
Brett Viren wrote:
>
> Hello,
>
> >From my experience with Gtk's set_usize() methods, I find it very
> useful to be able to set the minimum size of some/all of the widgets
> in an app. This allows the app to never be resized so small as to
> have widgets disappear or otherwise become unusable.
>
> I think TG classes would benifit from this idea, particularly classes
> like TRootEmbeddedCanvas which emits warning messages if the canvas
> size goes to zero.
>
> As far as I have found, there is no such mechanism in TG (right?), but
> I think it would be pretty easy to add. It only needs a couple of
> UInt_t's to hold the mins, some accessor methods and a copy of lines
> in the Resize() related methods (unless I miss something). Ie:
>
> void TGFrame::SetMinSize(UInt_t minw, UInt_t minh)
> {
> fMinWidth = minw;
> fMinHeight = minh;
> }
>
> void TGFrame::Resize(UInt_t w, UInt_t h)
> {
> // Resize the frame.
>
> // Assure min size, but only check if fMinXxx is non-zero
> if (fMinWidth && w < fMinWidth) w = fMinWidth;
> if (fMinHeight && h < fMinHeight) h = fMinHeight;
>
> if (w != fWidth || h != fHeight) {
> TGWindow::Resize(w, h);
> fWidth = w; fHeight = h;
> Layout();
> }
> }
>
> void TGFrame::MoveResize(...)
> {
> ... similar ...
> }
>
> -Brett.
--
Org: CERN, European Laboratory for Particle Physics.
Mail: 1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248
WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:07 MET