AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

button.

button

Syntax: 

	: button {
          action alignment fixed_height fixed_width
	  height is_cancel is_default is_enabled
	  is_tab_stop key label mnemonic width
        } 

DCL Coding: 
lisp48g : dialog {				//dialog name
          label = "button" ;			//give it a label

	: button {				//add a button
          label = "Message";			//give it a label
	  key = "btn1";				//give it a name
	  mnemonic = "M";			//give it a mnemonic
          fixed_width = true;			//fix the width
          alignment = centered;			//center the button
	}					//end button

        ok_cancel ;				//predefined OK/Cancel button

        }					//end dialog 

AutoLisp Coding: 
(defun C:lisp48g ()
;define function	

  (setq dcl_id (load_dialog "lisp48g.dcl"))
  ;load dialog

  (if (not (new_dialog "lisp48g" dcl_id)
  ;test for dialog

      );not

    (exit)
    ;exit if no dialog

  );if

  (action_tile
      "btn1"
      ;if the message button is pressed

      "(setq col (acad_colordlg 2))"
      ;display the AutoCAD colour dialogue  

  );action_tile

  (action_tile
      "accept"	
      ;if O.K. pressed
					
      "(done_dialog) (setq userclick T)"
      ;close dialog, set flag	
	
   );action tile

    (action_tile
    "cancel"
    ;if cancel button pressed

    "(done_dialog) (setq userclick nil)"	
    ;close dialog, lower flag

    );action_tile

  (start_dialog)	
  ;start dialog
				
  (unload_dialog dcl_id)
  ;unload	

  (if userclick
  ;if OK selected
   
   (progn
   ;do the following

     (setq col (itoa col))
     ;convert to string

     (alert (strcat "You selected Colour No: " col))
     ;inform the user

   );progn

  );if									

 (princ)

);defun

(princ)
 
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