comparison man/widget.texi @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 9d177e8d4150
children 576fb035e263
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
10 @c %**end of header 10 @c %**end of header
11 11
12 @ifinfo 12 @ifinfo
13 @dircategory XEmacs Editor 13 @dircategory XEmacs Editor
14 @direntry 14 @direntry
15 * Widgets: (widget). The Emacs Widget Library. 15 * Widgets: (widget). The Emacs Widget Library.
16 @end direntry 16 @end direntry
17 @end ifinfo 17 @end ifinfo
18 18
19 @node Top, Introduction, (dir), (dir) 19 @node Top, Introduction, (dir), (dir)
20 @comment node-name, next, previous, up 20 @comment node-name, next, previous, up
296 (switch-to-buffer (get-buffer-create "*Widget Example*")) 296 (switch-to-buffer (get-buffer-create "*Widget Example*"))
297 (kill-all-local-variables) 297 (kill-all-local-variables)
298 (make-local-variable 'widget-example-repeat) 298 (make-local-variable 'widget-example-repeat)
299 (widget-insert "Here is some documentation.\n\nName: ") 299 (widget-insert "Here is some documentation.\n\nName: ")
300 (widget-create 'editable-field 300 (widget-create 'editable-field
301 :size 13 301 :size 13
302 "My Name") 302 "My Name")
303 (widget-create 'menu-choice 303 (widget-create 'menu-choice
304 :tag "Choose" 304 :tag "Choose"
305 :value "This" 305 :value "This"
306 :help-echo "Choose me, please!" 306 :help-echo "Choose me, please!"
307 :notify (lambda (widget &rest ignore) 307 :notify (lambda (widget &rest ignore)
308 (message "%s is a good choice!" 308 (message "%s is a good choice!"
309 (widget-value widget))) 309 (widget-value widget)))
310 '(item :tag "This option" :value "This") 310 '(item :tag "This option" :value "This")
311 '(choice-item "That option") 311 '(choice-item "That option")
312 '(editable-field :menu-tag "No option" "Thus option")) 312 '(editable-field :menu-tag "No option" "Thus option"))
313 (widget-insert "Address: ") 313 (widget-insert "Address: ")
314 (widget-create 'editable-field 314 (widget-create 'editable-field
315 "Some Place\nIn some City\nSome country.") 315 "Some Place\nIn some City\nSome country.")
316 (widget-insert "\nSee also ") 316 (widget-insert "\nSee also ")
317 (widget-create 'link 317 (widget-create 'link
318 :notify (lambda (&rest ignore) 318 :notify (lambda (&rest ignore)
319 (widget-value-set widget-example-repeat 319 (widget-value-set widget-example-repeat
320 '("En" "To" "Tre")) 320 '("En" "To" "Tre"))
321 (widget-setup)) 321 (widget-setup))
322 "other work") 322 "other work")
323 (widget-insert " for more information.\n\nNumbers: count to three below\n") 323 (widget-insert " for more information.\n\nNumbers: count to three below\n")
324 (setq widget-example-repeat 324 (setq widget-example-repeat
325 (widget-create 'editable-list 325 (widget-create 'editable-list
326 :entry-format "%i %d %v" 326 :entry-format "%i %d %v"
327 :notify (lambda (widget &rest ignore) 327 :notify (lambda (widget &rest ignore)
328 (let ((old (widget-get widget 328 (let ((old (widget-get widget
329 ':example-length)) 329 ':example-length))
330 (new (length (widget-value widget)))) 330 (new (length (widget-value widget))))
331 (unless (eq old new) 331 (unless (eq old new)
332 (widget-put widget ':example-length new) 332 (widget-put widget ':example-length new)
333 (message "You can count to %d." new)))) 333 (message "You can count to %d." new))))
334 :value '("One" "Eh, two?" "Five!") 334 :value '("One" "Eh, two?" "Five!")
335 '(editable-field :value "three"))) 335 '(editable-field :value "three")))
336 (widget-insert "\n\nSelect multiple:\n\n") 336 (widget-insert "\n\nSelect multiple:\n\n")
337 (widget-create 'checkbox t) 337 (widget-create 'checkbox t)
338 (widget-insert " This\n") 338 (widget-insert " This\n")
339 (widget-create 'checkbox nil) 339 (widget-create 'checkbox nil)
340 (widget-insert " That\n") 340 (widget-insert " That\n")
341 (widget-create 'checkbox 341 (widget-create 'checkbox
342 :notify (lambda (&rest ignore) (message "Tickle")) 342 :notify (lambda (&rest ignore) (message "Tickle"))
343 t) 343 t)
344 (widget-insert " Thus\n\nSelect one:\n\n") 344 (widget-insert " Thus\n\nSelect one:\n\n")
345 (widget-create 'radio-button-choice 345 (widget-create 'radio-button-choice
346 :value "One" 346 :value "One"
347 :notify (lambda (widget &rest ignore) 347 :notify (lambda (widget &rest ignore)
348 (message "You selected %s" 348 (message "You selected %s"
349 (widget-value widget))) 349 (widget-value widget)))
350 '(item "One") '(item "Another One.") '(item "A Final One.")) 350 '(item "One") '(item "Another One.") '(item "A Final One."))
351 (widget-insert "\n") 351 (widget-insert "\n")
352 (widget-create 'push-button 352 (widget-create 'push-button
353 :notify (lambda (&rest ignore) 353 :notify (lambda (&rest ignore)
354 (if (= (length (widget-value widget-example-repeat)) 354 (if (= (length (widget-value widget-example-repeat))
355 3) 355 3)
356 (message "Congratulation!") 356 (message "Congratulation!")
357 (error "Three was the count!"))) 357 (error "Three was the count!")))
358 "Apply Form") 358 "Apply Form")
359 (widget-insert " ") 359 (widget-insert " ")
360 (widget-create 'push-button 360 (widget-create 'push-button
361 :notify (lambda (&rest ignore) 361 :notify (lambda (&rest ignore)
362 (widget-example)) 362 (widget-example))
363 "Reset Form") 363 "Reset Form")
364 (widget-insert "\n") 364 (widget-insert "\n")
365 (use-local-map widget-keymap) 365 (use-local-map widget-keymap)
366 (widget-setup)) 366 (widget-setup))
367 @end lisp 367 @end lisp
368 368