Re: Win32 modal support
| From: | (Jeff Beidler) | Date: | Thu, 01 Sep 2005 18:47:28 +0000 |
| Subject: | Re: Win32 modal support | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6187@lists.php.net to get a copy of this message | ||
Hi Tom,
I downloaded the pre-compiled dll's and replaced the applicable files in my PHP directory. However, this seems to cause my dialog box to not appear at all! It appears if I comment out the calls to set_modal() and set_transient_for(), but uncommenting those lines causes the new window to not show up. The parent window stops responding to clicks (like trying to close by hitting the "X" button, or choosing menu options), but still seems to accept file drops. Perhaps that part has more to do with something in the PEAR::Gtk_FileDrop package, though.
Tom Rogers wrote:
Hi,
Saturday, August 27, 2005, 5:09:50 AM, you wrote:
JB> Hello,
JB> Does anyone know of a workaround for set_modal() and set_transient_for() not
JB> working on Windows platforms?
JB> Thanks,
JB> Jeff
I have modified gdk to make this work under windows using gtk2.4 as a base. If you are compiling your own gtk replace the function:
gdk_window_set_transient_for() in ...gtkgdkwin32gdkwindow-win32.c
(which currently does nothing) with this:
gdk_window_set_transient_for (GdkWindow *window, GdkWindow *parent) { HWND window_id, parent_id; LONG style;
g_return_if_fail (window != NULL); g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("gdk_window_set_transient_for: %p %pn", GDK_DRAWABLE_XID (window), GDK_DRAWABLE_XID (parent)));
window_id = GDK_DRAWABLE_XID (window); parent_id = GDK_DRAWABLE_XID (parent);
if ((style = GetWindowLong (window_id, GWL_STYLE)) == 0)
WIN32_API_FAILED ("GetWindowLong");
style |= WS_CHILD;
if (!SetWindowLong (window_id, GWL_STYLE, style))WIN32_API_FAILED ("SetWindowLong");if (!SetParent (window_id, parent_id))WIN32_API_FAILED ("SetParent");
if (!RedrawWindow (window_id, NULL, NULL,
RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW))
WIN32_API_FAILED ("RedrawWindow");
}
If you need a precompiled dll you can download it from:
http://kwiktemplates.com/gtk.zip
If you don't want the parent to be active you will need to combine set_transient_for() with set_modal(). It also behaves in that it does not create a new icon on the taskbar and will minimize if the main window minimizes.
The only thing to watch for is if you kill the parent while the dialog is showing you will get a gdk error message. This won't happen if you use set_modal(TRUE) of course.