Re: [gnome-love] Correct way to create a child window?
- From: Adam Dingle <adam yorba org>
- To: captain deadly gmail com
- Cc: gnome-love gnome org
- Subject: Re: [gnome-love] Correct way to create a child window?
- Date: Sat, 20 Nov 2010 06:03:18 -0800
captain.deadly,
it sounds to me like you probably want to create a dialog. Dialogs are extra windows used to present information or get input from the user. They are typically smaller than your application's main window. Many commands in common GNOME applications open dialogs, such as the Edit->Find command in gedit, or the Edit->Preferences command in many applications. Dialogs can be either modal or modeless. When a modal dialog is displayed, only that dialog can receive input until it is closed. A modeless dialog allows both the dialog and the main window to be active simultaneously.
For learning about how to use dialogs and other GTK features, I recommend Andrew Krause's book Foundations of GTK+ Development. Chapter 5 of that book is specifically about dialogs and should tell you everything you need to know. If you don't have that book, you could look at the dialogs section in the GTK tutorial at
http://library.gnome.org/devel/gtk-tutorial/stable/x861.html, though that section is pretty brief and only has some fairly basic information. The official documentation for GtkDialog is at
http://library.gnome.org/devel/gtk/stable/GtkDialog.html . Also, if you're programming in Vala (my language of choice for writing GTK applications) there's a nice dialog example at
http://live.gnome.org/Vala/GTKSample#Creating_a_Dialog . Even if you're not programming in Vala, you could look at that example and then translate it to C or Python or whichever language you're using.
One final point. To build a dialog, you can either construct the dialog's widgets in code (like in the Vala example above), or you can use Glade, a program that lets you edit the dialog layout visually. Although Glade might sound easier, if you're just getting into GTK programming I'd actually recommend figuring out how to build the widgets in code first and then only learn how to use Glade once you're comfortable with that first approach.
Hope this helps!
adam
On Sat, Nov 20, 2010 at 2:13 AM,
<captain deadly gmail com> wrote:
Hello all,
I'm just starting out on writing gnome apps and wondering is there a
correct way to create a child window from a parent and display it. process
input from the child and then when it's finished drop back to the parent.
I'm searching the web but can't find anything specific, but that maybe down to
my search string. There are probably a few ways. I could reuse my current
toplevel window remove everything out of it and re populate it with the GUI
Elements which my child needs. Then when the child terminates repopulate
again. Or I could create a brand new top level windwo and populate it leaving
the previous window in place.
This is a very basic question I know and maybe there ain't even a right answer
to it. In any case if anybody can offer any advice I'd be very gratefull.
_______________________________________________
gnome-love mailing list
gnome-love gnome org
http://mail.gnome.org/mailman/listinfo/gnome-love
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]