Re: How to change the height of the top window from a program?



Thanks Richard,

I could make it work with gtk_window_resize. No flicker. Great!

However, the manual states that gtk_window_resize must use sizes greater or equal than those given to gtk_widget_size_request when top window is initialised, suggesting the following small modification.

Setting top window:
[code]
...
   gtk_window_set_title (GTK_WINDOW (window), title );
   gtk_widget_set_size_request (window, wdavail, smallheightval ); //request works
   gtk_window_resize ( (GtkWindow *)window, wdavail, htavail ) ;   // to full height-  works
   gtk_window_move ( (GtkWindow *)window, 0 , 0 );  // still works
...
   gtk_widget_show_all (window);
[/code]

where smallheightval is smaller than or equal to the reduced height.

Reducing height of top window:
[code]
...
  gtk_window_resize (window, wdavail, reducedheight );  // works now
...
[/code]

Restoring full size of top window:
[code]
...
  gtk_window_resize (window, wdavail, htavail );  // works now
...
[/code]


Again many thanks.

Ken


--- On Sat, 27/3/10, richard boaz <ivor boaz gmail com> wrote:

From: richard boaz <ivor boaz gmail com>
Subject: Re: How to change the height of the top window from a program?
To: "Ken Resander" <kresander yahoo com>
Cc: gtk-list gnome org
Date: Saturday, 27 March, 2010, 7:03 PM

i would think about embedding the dialog window you want at the bottom within the top window itself.  hiding and unhiding then, you can easily achieve the effect you want.

that is, unless the dialog *must* be its own separate top window.  is this true?

on the other hand, try using gtk_window_resize() instead, it will work where gtk_widget_set_size_request() is failing.

richard

On Sat, Mar 27, 2010 at 11:52 AM, Ken Resander <kresander yahoo com> wrote:
The top window has a menu and a single textview. This window uses all of the available area on the screen, but sometimes it has to make room for a dialog window that that needs to be just below. When the dialog window is no longer needed the top window should expand and reclaim the space at the bottom.

I want to do this by reducing and increasing the height of the top window by the program, but I cannot make it work.

Setting top window:
[code]
...
   gtk_window_set_title (GTK_WINDOW (window), title );
   gtk_widget_set_size_request (window, wdavail, htsrcwnd ); // request works
   gtk_window_move ( (GtkWindow *)window, 0 , 0 );   //  works
...
   gtk_widget_show_all (window);
[/code]

Reducing height of top window:
[code]
...
  gtk_widget_set_size_request (window, wdavail, reducedheight );  // request ignored
...
[/code]
So, the height of the top window remains as initialised.

I can destroy window by gtk_widget_destroy and then recreate another top window with reduced height and then place the dialog window at the bottom. However, this is ugly and irritating because the top window destroy and immediate recreate are clearly visible.

How can I make the transition a bit smoother?



Get your new Email address!
Grab the Email name you've always wanted before someone else does!
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list




New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]