/[estron]/trunk/dwi/examples/basic-sql/testwidgets.dui
ViewVC logotype

Contents of /trunk/dwi/examples/basic-sql/testwidgets.dui

Parent Directory Parent Directory | Revision Log Revision Log


Revision 385 - (hide annotations) (download)
Sat Jul 24 03:12:55 2004 UTC (8 years, 10 months ago) by linas
File size: 10502 byte(s)
file syntax changes
1 linas 93 <?xml version="1.0"?>
2     <!--
3     - FILE: testwidgets.dui
4     -
5     - FUNCTION:
6     - This is an example DWI database-to-glade scripting file.
7     - It contains an extravaganza of widget types. Well, not
8     - that extravagent, really, but over a dozen of the basic types.
9     - Under construction: radio buttons work, but not the final
10     - design.
11     - A better example of how to use DWI in general can be found
12     - in 'testbasic.dui'.
13     -
14     -->
15    
16     <dwi name="testwidgets">
17    
18     <!-- a filter to convert numeric values to strings -->
19     <filter name="unmenu" revname="menuchoice">
20     <lookup key="0" val="itty" />
21     <lookup key="1" val="bitty" />
22     <lookup key="2" val="teeny" />
23     <lookup key="3" val="weeny" />
24     </filter>
25    
26 linas 126 <database provider="libdbi" dbname="testbasic" host="localhost" username="linas">
27 linas 93
28     <window provider="glade" name="home page" main="yes"
29     filename="testwidgets.glade" root_widget="main window">
30    
31     <sigaction widget="main window" signal="destroy" action="main_quit"/>
32    
33    
34     <!-- show everything in the database -->
35     <!-- run this query automatically when main window comes up -->
36     <form type="select" tables="stuff" report="result list">
37     <select field="*"/>
38     <submit widget="main window" signal="show"/>
39     </form>
40    
41     <report name="result list">
42     <row widget="main clist">
43     <entry column="0" field="id"/>
44     <entry column="1" field="date"/>
45     <entry column="2" field="tick"/>
46     <entry column="3" field="summary"/>
47     </row>
48     </report>
49    
50     <form report="clear page">
51     <submit widget="new button" signal="clicked"/>
52     </form>
53    
54     <form type="select" tables="stuff" report="view record">
55     <select field="*"/>
56     <where widget="main clist" column="0" field="id" />
57     <submit widget="view button" signal="clicked"/>
58     </form>
59    
60     <form type="delete" tables="stuff" report="submit ok">
61     <where widget="main clist" column="0" field="id" />
62     <submit widget="delete button" signal="clicked"/>
63 linas 370 <refresh report="result list" />
64 linas 93 </form>
65    
66     </window>
67    
68     <!-- ============================================================ -->
69     <!-- ============================================================ -->
70     <!-- Move on to the next window. This window will serve primarily as
71     - a place to display the results of queries specified by the previous
72     - forms.
73     -->
74    
75 linas 385 <window provider = "glade"
76 linas 93 filename="testwidgets.glade" root_widget="details window">
77    
78     <sigaction widget="close button" signal="clicked" action="close_window"/>
79    
80     <form report="clear page">
81     <submit widget="clear button" signal="clicked"/>
82     </form>
83    
84     <report name="clear page">
85     <entry widget="id label" value="(no id assigned yet)" />
86     <entry widget="date edit" key="/system/datetime"/>
87     <entry widget="date string" key="/system/datetime"/>
88     <entry widget="checkbutton" value="0"/>
89     <entry widget="cbutton string" value="0"/>
90     <entry widget="summary entry" value="Type Something Here!"/>
91     <entry widget="summary string" value="Type Something Here!"/>
92     <entry widget="notes text" value="Here Too!"/>
93     <entry widget="notes string" value="Here Too!"/>
94     <entry widget="toggle button" value="0"/>
95     <entry widget="toggle string" value="0"/>
96     <entry widget="radio string" value="fee"/>
97    
98     <!-- Handling radio buttons.
99     - Associate data with each radio button. Later,
100     - we will copy the data from the seleted button to
101     - the database. Note, the last value specified
102     - will be the button that is depressed. -->
103     <entry widget="radio fee" value="fee "/>
104     <entry widget="radio fie" value="fie "/>
105     <entry widget="radio fo" value="fo "/>
106     <entry widget="radio fum" value="fum "/>
107     <entry widget="radio fee" value="fee "/>
108    
109     <entry widget="option menu" value="0"/>
110     <entry widget="menu string" value="0"/>
111     <entry widget="opt menu alt" value="0"/>
112     <entry widget="opt string" value="No choice yet"/>
113     <entry widget="combo" value="Combo!"/>
114     <entry widget="combo string" value="Combo!"/>
115     <entry widget="gnome entry" value="Gnome!"/>
116     <entry widget="gentry string" value="Gnome!"/>
117     <entry widget="spin button" value="10"/>
118     <entry widget="spin string" value="10"/>
119     <entry widget="hscale" value="0.0"/>
120     <entry widget="scale string" value="0.0"/>
121     <entry widget="hscrollbar" value="0"/>
122     <entry widget="scroll string" value="0"/>
123    
124     <entry widget="file entry" value="/etc/passwd"/>
125     <entry widget="file string" value="/etc/passwd"/>
126    
127     <!-- We can use the same window for editing and creating new
128     - records by customizing it a bit -->
129     <entry widget="details window" value="New Record Dialog"/>
130     <entry widget="big frame" value="Create a New Record"/>
131     <entry widget="submit button" arg="GtkWidget::sensitive" value="0"/>
132     <entry widget="new button" arg="GtkWidget::sensitive" value="1"/>
133     </report>
134    
135     <report name="view record">
136     <entry widget="id label" field="id" />
137     <entry widget="date edit" field="date"/>
138     <entry widget="date string" field="date"/>
139     <entry widget="checkbutton" field="tick"/>
140     <entry widget="cbutton string" field="tick"/>
141     <entry widget="summary entry" field="summary"/>
142     <entry widget="summary string" field="summary"/>
143     <entry widget="notes text" field="notes"/>
144     <entry widget="notes string" field="notes"/>
145     <entry widget="toggle button" field="tock"/>
146     <entry widget="toggle string" field="tock"/>
147     <entry widget="radio string" field="radio"/>
148    
149     <!-- Handling radio buttons.
150     - Associate data with each radio button. Later,
151     - we will copy the data from the seleted button to
152     - the database. Note, the last value specified
153     - will be the button that is depressed. -->
154     <entry widget="radio fee" value="fee "/>
155     <entry widget="radio fie" value="fie "/>
156     <entry widget="radio fo" value="fo "/>
157     <entry widget="radio fum" value="fum "/>
158    
159     <entry widget="radio fee" field="radio"/>
160    
161     <entry widget="option menu" field="menu"/>
162     <entry widget="menu string" field="menu"/>
163    
164     <!-- database returns a string for this field, but we want
165 linas 126 - an integer to set the menu. So run it through a filter. -->
166 linas 93 <entry widget="opt menu alt" field="altmenu" filter="menuchoice"/>
167     <entry widget="opt string" field="altmenu"/>
168     <entry widget="combo" field="combo"/>
169     <entry widget="combo string" field="combo"/>
170     <entry widget="gnome entry" field="gentry"/>
171     <entry widget="gentry string" field="gentry"/>
172     <entry widget="spin button" field="spin"/>
173     <entry widget="spin string" field="spin"/>
174     <entry widget="hscale" field="scale"/>
175     <entry widget="scale string" field="scale"/>
176     <entry widget="hscrollbar" field="scroll"/>
177     <entry widget="scroll string" field="scroll"/>
178    
179     <entry widget="file entry" field="filename"/>
180     <entry widget="file string" field="filename"/>
181    
182    
183     <!-- We can use the same window for editing and creating new
184     - records by customizing it a bit -->
185     <entry widget="details window" value="Edit Record Dialog"/>
186     <entry widget="big frame" value="Edit an Existing Record"/>
187     <entry widget="submit button" arg="GtkWidget::sensitive" value="1"/>
188     <entry widget="new button" arg="GtkWidget::sensitive" value="0"/>
189     </report>
190    
191     <!-- For new records, we just SQL INSERT ... VALUES ... -->
192     <form type="insert" tables="stuff" report="submit ok">
193     <submit widget="new button" signal="clicked" />
194     <insert widget="date edit" field="date" />
195     <insert widget="checkbutton" field="tick" />
196     <insert widget="summary entry" field="summary" />
197     <insert widget="notes text" field="notes" />
198     <insert widget="toggle button" field="tock" />
199     <!-- Its enough to specify any widget in the radio group. -->
200     <insert widget="radio fum" field="radio" />
201    
202     <insert widget="option menu" field="menu" />
203     <insert widget="opt menu alt" field="altmenu" filter="unmenu"/>
204     <insert widget="combo" field="combo" />
205     <insert widget="gnome entry" field="gentry" />
206     <insert widget="spin button" field="spin" />
207     <insert widget="hscale" field="scale" />
208     <!-- scrollbar returns float, but we need to store an int -->
209     <insert widget="hscrollbar" field="scroll" filter="to_int" />
210     <insert widget="file entry" field="filename" />
211    
212 linas 370 <refresh report="result list" />
213 linas 93 </form>
214    
215     <!-- For existing records, we SQL UPDATE ... WHERE ... -->
216     <form type="update" tables="stuff" report="submit ok">
217     <submit widget="submit button" signal="clicked" />
218     <where widget="id label" field="id" />
219     <insert widget="date edit" field="date" />
220     <insert widget="checkbutton" field="tick" />
221     <insert widget="summary entry" field="summary" />
222     <insert widget="notes text" field="notes" />
223     <insert widget="toggle button" field="tock" />
224     <!-- Its enough to specify any widget in the radio group. -->
225     <insert widget="radio fum" field="radio" />
226    
227     <insert widget="option menu" field="menu" />
228     <insert widget="opt menu alt" field="altmenu" filter="unmenu"/>
229     <insert widget="combo" field="combo" />
230     <insert widget="gnome entry" field="gentry" />
231     <insert widget="spin button" field="spin" />
232     <insert widget="hscale" field="scale" />
233     <!-- scrollbar returns float, but we need to store an int -->
234     <insert widget="hscrollbar" field="scroll" filter="to_int" />
235     <insert widget="file entry" field="filename" />
236    
237 linas 370 <refresh report="result list" />
238     <refresh report="view record" />
239 linas 93 </form>
240    
241     </window>
242    
243 linas 385 <window provider="glade"
244 linas 93 filename="testwidgets.glade" root_widget="submit msg">
245 linas 126 <report name="submit ok">
246 linas 93 <entry widget="submit msg" value="New Record Created"/>
247     </report>
248     </window>
249    
250    
251     </database>
252    
253     </dwi>
254     <!-- ===================== END OF FILE ========================== -->

  ViewVC Help
Powered by ViewVC 1.1.5