AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN




	: 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


    ;exit if no dialog


  (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

    ;if O.K. pressed

    ;string 'em together


      (setq lngth (get_tile \"eb1\"))"
      ;get slot length

      "(done_dialog)(setq userclick T))"
      ;close dialog, set flag


  );action tile

    ;if cancel button pressed

    "(done_dialog) (setq userclick nil)"	
    ;close dialog


  ;start dialog
  (unload_dialog dcl_id)

   (if userclick
   ;check O.K. was selected

      (alert (strcat "You Selected: " lngth))			
      ;display the selected length.

  );if userclick



The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website