Welcome to the Southern African Autolisp Website.
You are Visitor Number since 11th June 1999.
image_button.
Syntax:
: image_button {
action alignment allow_accept aspect_ratio
color fixed_height fixed_width height
is_enabled is_tab_stop key label mnemonic
width
}
DCL Coding:
lisp48n : dialog { //dialog name
label = "image_button" ; //give it a label
: boxed_row { //define a boxed row
label = "Choose a Colour"; //gie it a label
: image_button { //define image button
key = "im0" ; //give it a name
height = 1.0 ; //define height
width = 2.0 ; //define width
fixed_width = true; //fix the width
allow_accept = true ; //allow double-click
}
: image_button {
key = "im1" ;
height = 1.0 ;
width = 2.0 ;
fixed_width = true;
allow_accept = true ;
}
: image_button {
key = "im2" ;
height = 1.0 ;
width = 2.0 ;
fixed_width = true;
allow_accept = true ;
}
: image_button {
key = "im3" ;
height = 1.0 ;
width = 2.0 ;
fixed_width = true;
allow_accept = true ;
}
: image_button {
key = "im4" ;
height = 1.0 ;
width = 2.0 ;
fixed_width = true;
allow_accept = true ;
}
: image_button {
key = "im5" ;
height = 1.0 ;
width = 2.0 ;
fixed_width = true;
allow_accept = true ;
}
: image_button {
key = "im6" ;
height = 1.0 ;
width = 2.0 ;
fixed_width = true;
allow_accept = true ;
}
: image_button {
key = "im7" ;
height = 1.0 ;
width = 2.0 ;
fixed_width = true;
allow_accept = true ;
}
} //end boxed row
ok_cancel ; //predefined OK/Cancel button
} //end dialog
AutoLisp Coding:
(defun C:lisp48n ()
;define function
(setq dcl_id (load_dialog "lisp48n.dcl"))
;load dialog
(if (not (new_dialog "lisp48n" dcl_id)
;test for dialog
);not
(exit)
;exit if no dialog
);if
(setq width (dimx_tile "im0")
;get the image width
height (dimy_tile "im0")
;get the image height
) ;_ end of setq
(start_image "im0")
;start the image
(fill_image 0 0 width height 1)
;fill it with the relevant colour
(end_image)
;end the image
(setq width (dimx_tile "im1")
height (dimy_tile "im1")
) ;_ end of setq
(start_image "im1")
(fill_image 0 0 width height 30)
(end_image)
(setq width (dimx_tile "im2")
height (dimy_tile "im2")
) ;_ end of setq
(start_image "im2")
(fill_image 0 0 width height 2)
(end_image)
(setq width (dimx_tile "im3")
height (dimy_tile "im3")
) ;_ end of setq
(start_image "im3")
(fill_image 0 0 width height 3)
(end_image)
(setq width (dimx_tile "im4")
height (dimy_tile "im4")
) ;_ end of setq
(start_image "im4")
(fill_image 0 0 width height 4)
(end_image)
(setq width (dimx_tile "im5")
height (dimy_tile "im5")
) ;_ end of setq
(start_image "im5")
(fill_image 0 0 width height 5)
(end_image)
(setq width (dimx_tile "im6")
height (dimy_tile "im6")
) ;_ end of setq
(start_image "im6")
(fill_image 0 0 width height 6)
(end_image)
(setq width (dimx_tile "im7")
height (dimy_tile "im7")
) ;_ end of setq
(start_image "im7")
(fill_image 0 0 width height 7)
(end_image)
(action_tile "im0" "(setq la \"0\")")
'get the name of the colour selected
(action_tile "im1" "(setq la \"1\")")
(action_tile "im2" "(setq la \"2\")")
(action_tile "im3" "(setq la \"3\")")
(action_tile "im4" "(setq la \"4\")")
(action_tile "im5" "(setq la \"5\")")
(action_tile "im6" "(setq la \"6\")")
(action_tile "im7" "(setq la \"7\")")
(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
);action_tile
(start_dialog)
;start dialog
(unload_dialog dcl_id)
;unload
(if userclick
;check O.K. was selected
(alert (strcat "You Selected Colour: " la))
;display the colour selected.
);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.
|