Previous Up Next

KPlug Glade Tutorial

The Glade Properties Editor

The Glade Properties Editor changes depending upon which widget is having its properties set. Different widgets have different properties, of course, and therefore it is difficult to detail them all. There are several important properties to set, however.

There are four tabs available in the properties window, widget, packing, common and signals. Most of the things you will need to work with are under the widget, packing or signals tabs.

Commonly Used Properties

  • Name: Name appears for all widgets. Glade will supply a default, I suggest you change this to something unique for everything but containers. This is the widget name as used by the code in interface.c and callbacks.c
  • Class: Change this if you want. I don't bother, as the class is fine for me. You will have to mess with this if you use a custom widget, probably.
  • Border Width: This defaults to 0, you can make it larger if you want. Play with it to see what it does.
  • Title: You'll want to set this, it's what shows in the titlebar of the Window. It also shows on the panel in Gnome.
  • Type: What kind of window is this? You have top level, popup, and dialog to chose from.
  • Editable: Can the user edit what is in this widget? This is used for text widgets, generally.
  • Position: Where do you want the window to start? Generally let the user set this, all window managers have the ability to remember where windows are, it's annoying for the User if this gets reset to a default every time, but there are always exception of course.
  • Modal: Is the window modal? This means, does it grab control and not allow the user to do anything else with the application until the window has been closed? This is usually terribly annoying for the user, but there are cases where it's needed, when something absolutely must have their attention.
  • Position (under the Packing Tab): What position does this widget have in the container? (Note that this starts with 0, not 1)
  • Padding: How much padding to add around the widget. This can be useful to make pleasing windows.
  • Sensitive: Is the widget sensitive to input. Be careful here, setting a parent widget (ie a container) to insensitive makes the child insensitive as well.
  • Can Focus: The widget will accept the keyboard input before other widgets in the window. This can be annoying for a user, in some cases, if they move away from that window, come back to it, type something while looking at another window, and end up inputting data they didn't wish.
  • Can Default: If the user just hits enter from the keyboard, this widget will activate and default. Used for buttons, such as the 'cancel' or 'ok' buttons. Note you have to set has default for this to work.
  • Accelerators: Set these to allow ctrl, alt combinations to access parts of the windows. For instance, you have a 'Save' button. You want the user to be able to save when they hit ctrl-S.
  • Homogeneous: Are the boxes in the container all the same size? Or will they 'shrink to fit' each widget that is placed in them?
  • Size: How many boxes does the container have. You can change this after a window is built to add more boxes if you need to add more widgets.
  • Spacing: How wide is the space between boxes in a container widget?

 
The Signals Tab
The signals tab is where you add the handlers that connect to the different signals the various widgets emit. These signals vary, so I can't detail them here. They are mentioned along with the widgets in the widget pages in this tutorial. Below is an example of a button widget with a clicked signal handler added.
The Glade Signal Editor
To do this, or something similar, click on the ... next to the signal field. Pick a signal from the popup window (or add it to the field manually, if you want to type it out). Click on the add button in the popup window. Glade will suggest a signal handler name, based on the signal and the widget name. If you want to modify it, do so. Then click on the add button. Next time you build your source code, that handler will be in callbacks.c, waiting for you to add code so it will do something.

Previous Up Next