/[lgtk]/lgtk/examples/entry.lisp
ViewVC logotype

Contents of /lgtk/examples/entry.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Tue Nov 11 21:41:53 2003 UTC (10 years, 5 months ago) by mmommer
Branch: MAIN
CVS Tags: HEAD
Branch point for: test-branch, sbcl-port
Added text entries. Also added an example.
1 (use-package :gtk)
2
3 (defun entry ()
4
5 (labels ((end (&rest a) (declare (ignore a))
6 (gtk-main-quit))
7
8 (ed-toggle (wid data)
9 (gtk-editable-set-editable data
10 (gtk-toggle-button-get-active wid)))
11
12 (vi-toggle (wid data)
13 (gtk-entry-set-visibility data
14 (gtk-toggle-button-get-active wid)))
15
16 (get (wid data)
17 (format t "Got : ~S~%"
18 (gtk-entry-get-text data))))
19
20 (let ((win (gtk-window-new :gtk-window-toplevel))
21 (vbox (gtk-vbox-new :homogeneous t))
22 (hbox (gtk-hbox-new :homogeneous t))
23 (txt (gtk-entry-new))
24 (ed (gtk-check-button-new-with-label
25 "Editable"))
26 (vi (gtk-check-button-new-with-label
27 "Visible"))
28 (get (gtk-button-new-with-label "Get!")))
29
30 (gtk-container-set-border-width win 10)
31
32 (gtk-container-add win vbox)
33
34 (gtk-box-pack-start vbox txt)
35 (gtk-box-pack-start vbox hbox)
36 (gtk-box-pack-start vbox get)
37
38 (gtk-box-pack-start hbox ed)
39 (gtk-box-pack-start hbox vi)
40
41 (gtk-widget-show-all win)
42
43 (g-signal-connect win gtkdestroy #'end)
44 (g-signal-connect ed gtkclicked #'ed-toggle :data txt)
45 (g-signal-connect vi gtkclicked #'vi-toggle :data txt)
46 (g-signal-connect get gtkclicked #'get :data txt)
47
48 (gtk-toggle-button-set-active ed T)
49 (gtk-toggle-button-set-active vi T)
50
51 (gtk-main))))

  ViewVC Help
Powered by ViewVC 1.1.5