3
;; Create a top-level window that displays a horizontal scale.
6
;; w - Name to use for new top-level window.
10
(defun mkHScale (&optional (w '.scale2))
11
(if (winfo :exists w :return 'boolean) (destroy w))
14
(wm :title w "Horizontal Scale Demonstration")
15
(wm :iconname w "Scale")
16
(message (conc w '.msg) :font :Adobe-times-medium-r-normal--*-180* :aspect 300
17
:text "A bar and a horizontal scale are displayed below. (if :you click or drag mouse button 1 in the scale, you can change the width of the bar. Click the \"OK\" button when you're finished.")
18
(frame (conc w '.frame) :borderwidth 10)
19
(button (conc w '.ok) :text "OK" :command (tk-conc "destroy " w))
20
(pack (conc w '.msg) (conc w '.frame) (conc w '.ok) :side "top" :fill "x")
22
(frame (conc w '.frame.top) :borderwidth 15)
23
(scale (conc w '.frame.scale) :orient "horizontal" :length 280 :from 0 :to 250
24
:command (tk-conc "setWidth " w ".frame.top.inner") :tickinterval 50
26
(frame (conc w '.frame.top.inner) :width 20 :height 40 :relief "raised" :borderwidth 2
28
(pack (conc w '.frame.top) :side "top" :expand "yes" :anchor "sw")
29
(pack (conc w '.frame.scale) :side "bottom" :expand "yes" :anchor "nw")
32
(pack (conc w '.frame.top.inner) :expand "yes" :anchor "sw")
33
(funcall (conc w '.frame.scale) :set 20)
36
(defun setWidth (w width)
37
(funcall w :config :width ${width} :height 40)