//Slider dcl
Slider : dialog { //dialog name
label = "slider"; //give it a label
: edit_box { //define edit box
key = "eb1"; //give it a name
label = "Amount value: "; //give it a label
edit_width = 6; //6 characters only
} //end edit box
: slider { //define slider
key = "myslider"; //give it a name
max_value = 1000; //upper value
min_value = 100; //lower value
value = "50"; //initial value
} //end slider
ok_cancel; //predefined OK/Cancel button
} //end dialog
;-----------------------
;slider and edit box lisp
;-----------------------
(setq Amount
250) ;preset
(mode_tile "eb1" 2) ;switch focus to edit box (action_tile "myslider" "(slider_action $value $reason)") ;if user moves slider then pass arguments to slider_action (action_tile "eb1" "(ebox_action $value $reason)") ;if user enters slot length then pass arguments to ebox_action
;if O.K. pressed then string 'em together
(action_tile "accept" (strcat "(progn (setq Amount (get_tile \"eb1\")) (done_dialog) (setq userclick T))"))
;if cancel button pressed then close dialog
(action_tile "cancel" "(done_dialog) (setq userclick nil)")
;check O.K. was selected then display the selected length.
);defun
;define function
;---------------
(defun slider_action
(val why
) (if (or (= why
2) (= why
1)) (set_tile "eb1" val
)) ;check values then update edit box )
(defun ebox_action
(val why
) (if (or (= why
2) (= why
1)) (set_tile "myslider" val
)) ;check values then update slider )