[Gtk-sharp-list] Detecting Window Maximization State

Salvatore Scarciglia s.scarciglia at hyperphar.com
Fri Apr 28 06:14:12 EDT 2006


On Fri, 28 Apr 2006 16:56:19 +0700
"Agro Rachmatullah" <agro1986 at gmail.com> wrote:

> I tried searching Monodoc for a Window property to detect maximization
> state (Maximized, IsMaximized, etc) but didn't find any. Is there a
> way to do it?

Hi,
try this:

First of all define you own event handler for WindowStateEvent:
...
mainWindow.WindowStateEvent+=stateChanged;
...

then write your code (the following handle the minimize state):

...

	private void stateChanged (object sender, WindowStateEventArgs a){
		Gdk.EventWindowState ews = a.Event;
		WindowState newWs = ews.NewWindowState;
		if(newWs == WindowState.Iconified) {
			SysTrayIcon.mainWinOnScreen = false;
			mainWindow.Visible = false;
		}
	}
...

View the WindowState members for all the Widget status !

Bye

-- 

Salvatore ---------------------<|
LAAS --------------------------<|
http://laas.altervista.org ----<|


More information about the Gtk-sharp-list mailing list