How to create a Windows Style file selection modally using GTK?

Dear All,
I am writing a GTK application on Win32. I need to create a Windows style file selection dialog using GetOpenFileName function. I have referred to your source code to see how you did it (filedialogimpl-win32.cpp). I see you are calling GetOpenFileName in another thread, and in the main thread, you can g_main_loop_run to block the main window and make the file selection dialog modally.
But when I write my code, I cannot block the main window. It seems that calling g_main_loop_run function would also accept and handle signals from the main window, making the main window still active.
So can anyone tell me how you make your Windows style file selection dialog modally (preventing the main window from active) ?
Bruce Cheng --

Did you set hwndOwner?
Oh, I did not. I do not know what the parent window mean. It mean the top level window?
Bruce Cheng --
-----Original Message----- From: Jasper van de Gronde [mailto:th.v.d.gronde@...528...] Sent: Thursday, July 15, 2010 4:52 PM To: Bruce Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] How to create a Windows Style file selection modally using GTK?
Bruce wrote:
... So can anyone tell me how you make your Windows style file
selection
dialog modally (preventing the main window from active) ?
Did you set hwndOwner?

I set hwndOwner to the main window, using function (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parent->gobj()), but still cannot make the dialog modal.
Bruce Cheng --
-----Original Message----- From: Bruce [mailto:bruce1914@...400...] Sent: Thursday, July 15, 2010 4:55 PM To: 'Jasper van de Gronde' Cc: 'inkscape-devel@lists.sourceforge.net' Subject: RE: [Inkscape-devel] How to create a Windows Style file selection modally using GTK?
Did you set hwndOwner?
Oh, I did not. I do not know what the parent window mean. It mean the top level window?
Bruce Cheng
-----Original Message----- From: Jasper van de Gronde [mailto:th.v.d.gronde@...528...] Sent: Thursday, July 15, 2010 4:52 PM To: Bruce Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] How to create a Windows Style file selection modally using GTK?
Bruce wrote:
... So can anyone tell me how you make your Windows style file
selection
dialog modally (preventing the main window from active) ?
Did you set hwndOwner?

Bruce wrote:
I set hwndOwner to the main window, using function (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parent->gobj()), but still cannot make the dialog modal.
"drawable" doesn't sound like the main window, but I'm not a GTK/GDK expert. You may want to use Spy++ to see exactly what's going on (if you don't have it and can't find it, mail me personally).

"drawable" doesn't sound like the main window, but I'm not a GTK/GDK expert. You may want to use Spy++ to see exactly what's going on (if you
Calling (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parent->gobj()) function is what Inkscape did, but I am not sure where its argument 'parent' came from. Let me look at the source code of Inkscape in more detail, to see where its argument 'parent' comes from.
But thanks for your kind help first! ^_^
Bruce Cheng --
-----Original Message----- From: Jasper van de Gronde [mailto:th.v.d.gronde@...528...] Sent: Thursday, July 15, 2010 5:15 PM To: Bruce Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] How to create a Windows Style file selection modally using GTK?
Bruce wrote:
I set hwndOwner to the main window, using function
(HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parent->gobj()), but still cannot make the dialog modal.
"drawable" doesn't sound like the main window, but I'm not a GTK/GDK expert. You may want to use Spy++ to see exactly what's going on (if you don't have it and can't find it, mail me personally).
participants (2)
-
Bruce
-
Jasper van de Gronde