Re: maximize window
| From: | Tom Rogers | Date: | Tue, 20 Jul 2004 05:51:20 +0000 |
| Subject: | Re: maximize window | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-4801@lists.php.net to get a copy of this message | ||
Hi,
Saturday, July 17, 2004, 8:02:19 PM, you wrote:
WS> Hello,
WS> I want to maximize my window from the code, but I can't find the
WS> function for it.
$window->>set_usize(gdk::screen_width(),gdk::screen_height());
WS> but this only sets the window size equal to maximize , it is not truly
WS> maximized.
WS> Does anyone know?
WS> wim stockman
WS> Belgium
I did some tinkering and for windows came up with this solution using
the win32api. If on unix maybe you can do something similar with
gdkwindow->xid which is not available under windows
<?php
if (!extension_loaded('gtk')) {
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
dl("php_w32api.dll");
}
//start windows api class
$api =& new win32;
//defines
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");
//gtk shutdown function
function shutdown() {
Gtk::main_quit();
}
//main window
$window =& new GtkWindow();
$window->set_title('PHP Test');
$window->set_policy(true, true, false);
$window->connect('destroy', 'shutdown');
$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);
}
Gtk::main();
?>
--
regards,
Tom