Re: GtkWindow set_focus() method

From: Date: Thu, 09 Sep 2004 23:59:34 +0000
Subject: Re: GtkWindow set_focus() method
References: 1 2 3  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5064@lists.php.net to get a copy of this message
Malk0 escribió:
Hi i'm just wondering if the raise method of a gdkwindow isn't what you're looking for, but i've not test it yet? http://gtk.php.net/manual/fr/gdk.gdkwindow.method.raise.php regards, nathan On Thu, 09 Sep 2004 21:48:33 +0200, Gonzalo Monzón <gmc@serveisw3.net> wrote:
Gonzalo Monzón escribió:
Hi guys! I hope somebody could drop me a line... I'm working in some win32 php-gtk apps, and now I'm turning around my app's window management so a window wich maybe is minimized or just in second plane would get on top as the user presses a menu option once that window was yet opened before... Some time ago I made some tests but they were all unsuccesfull, i'd like to hear from somebody who could drop me a hand and I expect this is possible with actual version of php-gtk, maybe not... Maybe this would be made doing some interaction with the os desktop manager, and I question myself about if in win32 the way should be to do some hacking with the win32apis? ... Calling set_focus method for the window doesn't seem to do nothing in this case... and I don't know anymore methods to do this using gtk objects... maybe I'm wrong? Thank you in advance, Gonzalo Monzon
     
Sorry to all, now I realized my doc was not the last release, so I see some win32api calls to do the job at this url: http://gtk.php.net/manual/en/gtk.gtkwindow.php /////////////////////// dl("php_w32api.dll"); $api =& new win32; define('SW_MAXIMIZE',3); define('SW_MINIMIZE',6); //register windows functions $api->registerfunction("long GetLastError Alias GetError () From kernel32.dll"); $api->registerfunction("long FindWindow (string &ClassName, string &WindowName) From user32.dll"); $api->registerfunction("long ShowWindow (long hWnd, long nCmdShow) From user32.dll"); $window =& new GtkWindow(); $window->set_title('PHP Test'); $window->show(); $class_string = 'gdkWindowToplevel'; $title_string = 'PHP Test'; if(!$sw = $api->FindWindow($class_string,$title_string)){ $error = $api->getError(); echo ' Oops FindWindow error: '.$error."\n"; }else{ $api->ShowWindow($sw,SW_MAXIMIZE); } ////////////////////// Some more info about this question: * You must search for the right class_string: gdkWindowToplevel
       other values are gdkWindowDialog, gdkWindowPopup
* If you just need to set the window on top of screen, this can
       be accomplished minimizing and restoring the window.
* You could maximize any kind of window, included the cases the user can't To restore a window: SW_RESTORE = 4 This seems to work fine on win32! Gonzalo Monzon -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
I tested it only a bit but it doesn't work well with my app structure by
now -or so I can't do it work well without some effort-, so implemented easy the win32 api calls to find and show window, but anyway both methods $window->raise(); and $window->lower(); work well. I will think about solving this matter for non-win32 version of my php-gtk app... I think I'd need to do some class hacking in my app to make it work (now I don't want to load in memory up to 50 data-entry windows so I could access the raise method from a parent's class of the windows, the parent who calls the child windws extensions classes when needed) ... ;-) Thanks anyway for your reply, Gonzalo Monzon

« previous php.gtk.general (#5064) next »