Changeset 25575 in project
- Timestamp:
- 11/26/11 10:46:54 (9 years ago)
- Location:
- wiki
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/4/iup
r23711 r25575 17 17 See [[http://www.chust.org/fossils/iup/doc/trunk/api/main.wiki|the official API docs]]. 18 18 19 === Examples 20 21 See [[iup-tutor|Tutorial on the Iup GUI toolkit]] 22 19 23 === License 20 24 -
wiki/iup-tutor
r25572 r25575 17 17 Hence you need to consult the original C documentation very often. So it 18 18 seems appropriate to start with an example (Hello World, you guess it) 19 showing how a C program is transformed to Scheme. But before that let me 20 recapitulate some design principles of Iup. 19 showing how a C program is translated to Scheme. This way you'll become 20 comfortable writing Scheme programs while using the original C 21 documentation. But before that let me recapitulate some design 22 principles of Iup. 21 23 22 24 === Iup's design principles … … 35 37 First: No widget is ever positioned with explicit coordinates. 36 38 Everything is done logically by nesting containers and positioning 37 widgets . This facilitates matters considerably.39 widgets like fill. This facilitates matters considerably. 38 40 39 41 Second: All widgets and dialogs are controlled by attributes, including … … 226 228 <enscript highlight="C"> 227 229 228 widget=widget- name[attribute-name=attribute-value, ...](arg, ...)230 widget=widget-type[attribute-name=attribute-value, ...](arg, ...) 229 231 230 232 </enscript> … … 239 241 btn = button[TIP = "Close window", EXPAND = Yes] 240 242 ("&Ok", 0) 243 241 244 dlg = dialog[TITLE = Hello] 242 245 (vbox[GAP = 10, MARGIN = 15x15, ALIGNMENT = ACENTER] … … 263 266 </enscript> 264 267 265 Note, that the LED-import is done via lload/let and the identification268 Note, that the LED-import is done via load/let and the identification 266 269 of LED-names with Chicken-variables via handle-ref. 267 270 268 Note also, that btn must be coded separately , because we need to set the269 callback, which can not be a string.271 Note also, that btn must be coded separately and given a name, because 272 we need to set the callback, which can not be a string. 270 273 271 274 You can compile hello13.scm with csc and change hello.led afterwards. 272 Try it out and play with some attributes ... 275 Try it out and play with some attributes, for example, remove the 276 EXPAND attribute from btn and set it for label, ... 273 277 274 278 === Porting some examples from the Iup Distribution … … 278 282 279 283 ==== fill.scm 284 285 The following dialog shows, how different positions of the fill widget 286 change the dialog's appearance. 280 287 281 288 <enscript highlight="Scheme"> … … 319 326 'close))) 320 327 title: "Right aligned")) 328 321 329 ; Note, that callbacks should return a symbol. 322 330 ; Only the symbol 'close of the action: callbacks closes the dialog! … … 340 348 341 349 ==== hbox.scm 350 351 This dialog shows, how horizontal boxes within vertical ones work. 342 352 343 353 <enscript highlight="Scheme"> … … 388 398 </enscript> 389 399 390 Now a menu example391 392 400 ==== menu.scm 393 401 394 Now a dialog with a menu. 402 Now a dialog with a menu and submenus, one of whose items call a 403 predefined message-dialog. 395 404 396 405 <enscript highlight="Scheme"> … … 454 463 Nov 25, 2011 455 464 465 == Last updated 466 467 Nov 26, 2011
Note: See TracChangeset
for help on using the changeset viewer.