I must be the biggest retard in the world…..I have been programming AutoLISP what seems like forever…..never really messed with dialog boxes in my programs….so I get the wild hair to rewrite a few of my programs with dialog boxes and talk about making my feel like a idiot……something as simple as getting a radio_button to tell me which one is selected and do a "setq" seems to be too much for me…I cant get it, I've tried everything I have read or can find. Please, someone tell me what I'm doing wrong.
As you can see, I've tried every IF statement I can think of……………all I want it to do is when I pick "one" of the radio_buttons (I used radio_buttons so the user could only pick one), return to me which one they picked and (setq scale) to a value I have in my lisp routine.
Why is that so hard??? Something so simple is eating my lunch.
Thank you,
Seventhram
Seventhram,
Sometimes it's confusing at first. In the lisp part I moved the (start_dialog) after the action_tile calls.
In the dialog part it needed a the main boxed_radio_column that the radio_buttons are part of.
Welcome,
Bennett
Code:
;Border.lsp
(defun c:Border (/ dcl_id return)
(setq dcl_id (load_dialog "Border.dcl"))
(new_dialog "border" dcl_id);Remember that dcl is case sensitive, so use the same case as is in the dcl file.
(action_tile "ascale" "(setq Scale $value)")
(setq return (start_dialog));This line needs to be after action_tile calls.
(unload_dialog dcl_id)
(if (= return 0) (exit));Exit if Cancel selected.
(cond
((= Scale "as1")(setq Scale "111"));Don't you want these to be numbers?
((= Scale "as2")(setq Scale "222"))
((= Scale "as3")(setq Scale "4444"))
)
(princ "\nScale = ")(princ Scale)
(princ)
)
I used your suggestions Bennett, it worked perfectly. I'm still a little confused, but it works. Yes, I needed those to be real #'s, I just did a "atof" to convert it to a real #. Now that I have it working, I can re-write it again for engineering scales and architectural scales. I'm trying to totally eliminate the user from using a non-standard scale....then set the border, set-up all the text, dim's.....actually try to standardize things....imagine that, a company actually using standards....lol
Seventhram,
You're too kind! Thanks. I noticed that I forgot to declare Scale and setq it's default in my version. If the user was to pick the OK button before selecting a scale the return would be nil. I've included the revised version. Have you given any thought to using a popup list version of your dialog. It takes up much less space than rows of radio buttons. Just let me know.
Bennett
Bennett, thanks again, I totally over looked setting a default scale, thats a good idea, thank you. My original design for this dialog box was to use a pop-up list, but I had even more trouble getting that to work. The way I wanted to design it was to have two different popup list, one architectural scale and one engineering scale with a radio buttom above each one and you could only toggle back and forth between arch and eng scales, when you selected one, the other popup list could not be selected. In the one below, I have them stacked, and every time I tried to get them side by side I couldnt get it to work....actually two side by side groups where if you select one, the other can not be selected.
As you can imagine using radio buttoms it gets to be a pretty long dialog box, where using a popup list would make it a lot smaller.....but as before, how do you get the value of the popup to be returned in my lisp program??
Yea, that looks better! You mentioned graying out one of the lists depending if they chose Architectural or Engineering. How about just changing the values in one list. Here's what I put together. I added a variable named RealScale that you might be able to use in the rest of your program.
Bennett
OMG Bennett, you wouldnt believe how well that works, that is perfect, I merged that with the rest of my border program and its perfect.
What is very frustrating to me, the book I bought on Amazon talks nothing about doing these things. What book would you suggest that shows things like this.......pulling a list from a LISP program and using it in a DCL, then returning info from DCL back to the LISP.....got any suggestions on a good book??
Thank you very much for your help with this,
Seventhram
Shouldn't you have named this thread "Yes, I can get it."?
A friend that I used to work with was fairly advance in AutoLISP. When he left the company we kept in contact via email. I asked him to help me with a similar border drawing setup routine with a dialog. I sent him what I had started and he emailed me back with the finished program. He mentioned in his email to never ever hard code your lists in your dialog code. I couldn't even find an example of what he was talking about, but it was in his program. You'll do someone else a favor someday too.
Bennett