Welcome to the Southern African Autolisp Website.
You are Visitor Number since 11th June 1999.
slider.
Syntax:
: slider {
action alignment big_increment fixed_height
fixed_width height key label layout max_value
min_value mnemonic small_increment value width
}
Note : As a slider should be used in conjunction with an edit box, the DCL and
AutoLisp coding for the edit box has been included here.
DCL Coding:
lisp48m : dialog { //dialog name
label = "slider" ; //give it a label
: edit_box { //define edit box
key = "eb1" ; //give it a name
label = "Slot &Length (O/All Slot)" ; //give it a label
edit_width = 6 ; //6 characters only
} //end edit box
: slider { //define slider
key = "myslider" ; //give it a name
max_value = 100; //upper value
min_value = 0; //lower value
value = "50"; //initial value
} //end slider
ok_cancel ; //predefined OK/Cancel button
} //end dialog
AutoLisp Coding:
(defun C:lisp48m ()
;define function
(setq lngth 50.0)
;preset slot length
(setq dcl_id (load_dialog "lisp48m.dcl"))
;load dialog
(if (not (new_dialog "lisp48m" dcl_id)
;test for dialog
);not
(exit)
;exit if no dialog
);if
(set_tile "eb1" "50")
;put data into edit box
(mode_tile "eb1" 2)
;switch focus to edit box
(action_tile "myslider"
;if user moves slider
"(slider_action $value $reason)")
;pass arguments to slider_action
(action_tile "eb1"
;if user enters slot length
"(ebox_action $value $reason)")
;pass arguments to ebox_action
(defun slider_action (val why)
;define function
(if (or (= why 2) (= why 1))
;check values
(set_tile "eb1" val)))
;update edit box
(defun ebox_action (val why)
;define function
(if (or (= why 2) (= why 1))
;check values
(set_tile "myslider" val)))
;update slider
(action_tile
"accept"
;if O.K. pressed
(strcat
;string 'em together
"(progn
(setq lngth (get_tile \"eb1\"))"
;get slot length
"(done_dialog)(setq userclick T))"
;close dialog, set flag
);strcat
);action tile
(action_tile
"cancel"
;if cancel button pressed
"(done_dialog) (setq userclick nil)"
;close dialog
);action_tile
(start_dialog)
;start dialog
(unload_dialog dcl_id)
;unload
(if userclick
;check O.K. was selected
(alert (strcat "You Selected: " lngth))
;display the selected length.
);if userclick
(princ)
);defun
(princ)
All Tutorials and Code are provided "as-is" for purposes of instruction and
utility and may be used by anyone for any purpose entirely at their own risk.
Please respect the intellectual rights of others.
All material provided here is unsupported and without warranty of any kind.
No responsibility will be taken for any direct or indirect consequences
resulting from or associated with the use of these Tutorials or Code.
Copyright © 1999 by
Kenny Ramage
All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage.
|