HOWTO have more that a blank windows
As you have followed, or only read the first part, this with help you to populate your blank windows.
Basic content
First you may want a general link to the database.
<dbobject name="payment-win">
<table>payment</table>
<loadall/>
</dbobject>
This create a database object link to the table payment an include all the fields.
Now, as in gtk design, you need a box and cells to put widgets inside.
<vbox spacing="0">
<cell>
</cell>
<cell>
</cell>
</vbox>
Nice box but with no widgets inside it will display nothing.
Build a menu
For a basic menu we need:
- A menu bar <menubar> to put menu label inside.
- A menu label <menu label="_Payment"> to put item inside this one is named Payment with 'P' as short key.
- A menu item <menuitem stock="gtk-close"> this one will have the predefined icon of "gtk-close".
- A trigger in the item <trigger event="click"> who will catch the click on the item.
- An action <api call="close"> who will call the close function.
- A widget reference <widget>payment-win</widget> as an argument to the api function.
Add a menu now in the box.
<menubar>
<menu label="_Payment">
<menuitem stock="gtk-close">
<trigger event="click">
<api call="close">
<widget>payment-win</widget>
</api>
</trigger>
</menuitem>
</menu>
</menubar>
Remember of the full code for this step :
<!DOCTYPE bond SYSTEM "../../bond-2.1.dtd">
<bond
xmlns="http://bond.treshna.com/ns/v2.0"
xmlns:xi="http://www.w3.org/2003/XInclude">
<project name="Simple bond example" defaultvisible="false"
author="treshna Enterprises Ltd"/>
<window name="payment-win"
title="Payment details" visible="true">
<dbobject name="payment-win">
<table>payment</table>
<loadall/>
</dbobject>
<vbox spacing="0">
<cell>
<menubar>
<menu label="_Payment">
<menuitem stock="gtk-close">
<trigger event="click">
<api call="close">
<widget>payment-win</widget>
</api>
</trigger>
</menuitem>
</menu>
</menubar>
</cell>
<cell>
</cell>
</vbox>
</window>
</bond>
Toolbar
Adding a tollbar.
Mostely the same as for menu bar.
We get some actions :
- "close" to close the windows.
- "add" to add e new record.
- "delete" to delete the curent record.
- "save" to save the curent record.
The basic toolbar code :
<toolbar style="icons">
<toolbutton stock="gtk-close">
<trigger event="click">
<api call="close">
<widget>payment-win</widget>
</api>
</trigger>
</toolbutton>
<toolbutton stock="gtk-add">
<trigger event="click">
<api call="add">
<widget>payment-win</widget>
</api>
</trigger>
</toolbutton>
<toolbutton stock="gtk-delete">
<trigger event="click">
<api call="delete" confirm="true">
<widget>payment-win</widget>
</api>
</trigger>
</toolbutton>
<toolbutton stock="gtk-save">
<trigger event="click">
<api call="save">
<widget>payment-win</widget>
</api>
</trigger>
</toolbutton>
</toolbar>

Previous page Next page