Jump to content

Multi Radio Buttons.lsp 2

   (1 review)

1 Screenshot

About This File

Multiple Radio Buttons
 
Multiple Radio Buttons is a library routine that allows you to create as many Buttons of input as required (subject to Autocad limits) using a dialouge rather than the command line.

 

You can have horizontal or vertical buttons choice is yours 

 

Its use is intended where you want the user to pick one only of preset values it can be a number, a character or a whole word.

 

It can be used in most lisp code with just a couple of lines of code, compared to a hard coded solution of around 50+ lines repeated every time you want to use a dcl.

 

To use just save the "Multi Radio Buttons.lsp" to a directory that is included in you Autocad search path. If you need more information how to do this send an email to info@alanh.com.au 

 

It only requires 3 lines of code in any lisp to use.
(if (not AH:Butts)(load "Multi radio buttons.lsp"))         ; loads the program if not loaded already
(if (= but nil)(setq but 1))                     ; this is needed to set default button for user pick
(setq ans (ah:butts but "V"   '("A B C D " "A" "B" "C" "D" )))    ; V is for vertical H for horizontal layout    

In the example above the variable ans will have the button string value. 


(setq ans (ah:butts but "V"   '("Please choose " "Alpha" "Beta" "1" "2" "No words")))
Pick button 5  ans = "No words" 

The program resets the default button to last pick so click Ok, can be removed if not required.

 

Copy the 3 lines above to your command line to see how it works. There is extra examples in the top of the code how to use in your code. 

 

For programmers it is a replacement for the Initget function.

If you want further information or conversion of your code email info@alanh.com.au
 


What's New in Version 1.0.0   See changelog

Released

No changelog available for this version.


User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest

  • This will not be shown to other users.
  • Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
    Add a review...

    ×   Pasted as rich text.   Restore formatting

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


seawind

· Edited by seawind

  

i guess

             (apply 'max (mapcar ''((x) (strlen x)) butlst)) is better than 

              (+ (strlen (nth 0 butlst)) 10) 2 0)    ; increase 10 if label does not appear

or 

(setq len 10)
(foreach lstlen AHbutlst
        (if      (> (strlen lstlen) len)

                 (setq len (strlen lstlen))

        )
)

...

(rtos  len 2 0) " ;")  fo)   ; increase 10 if label does not appear

 

but i am new to lsp so my opinion aint count so much

Response from the author:

Thank you for the comments. 

 

There is a few hidden things you can do with the multi functions like you can save the last button pressed so when ran again its set as default, same in Multi getvals can save last entered values as defaults.

 

There is also Radio Buttons 2 columns & 3. Getvals 2 columns.

 

Hidden  away is make dcl from Autocad objects uses blocks and text writes DCL code. You need to have a good understanding of dcl as I use it when making custom dcl's. Speeds up code generation.

 

Link to review
×
×
  • Create New...