Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HeavyThumper on June 25, 2021, 03:14:19 PM
Title: How can I create a literal list - but with a runtime mod?
Post by: HeavyThumper on June 25, 2021, 03:14:19 PM
I'm trying to dynamically build a DCL. Prior to execution, I know everything about the desired DCL structure...except the desired width. So I have a setup like:
The above is just a small extract - the remainder of the DCL is structured correctly to finish. Now, I thought I'd pass the width to my DCL creation function and modify it accordingly. So I changed my list to:
This...doesn't work. As a workaround I have a foreach processing the literal list up to the first width occurrence - then I stop the list, explicitly write the width line, and then resume the foreach with another list section. There's gotta be a better way of doing this.
Is the problem that I can't use literals in this way - and need to assign the list(s) to a variable and then perform the needed modifications against that variable? Then the simple foreach would work again.
Title: Re: How can I create a literal list - but with a runtime mod?
Post by: ronjonp on June 25, 2021, 03:52:43 PM
Title: Re: How can I create a literal list - but with a runtime mod?
Post by: JohnK on June 25, 2021, 03:54:08 PM
I believe you just have to write out the dialog file piece at a time. Below is an example I had from a very long time ago (2003-ish) so I apologize but I've lost all DCL knowledge I had.
EDIT: FYI: ronjonp knows more than I. Try his solution first.
Title: Re: How can I create a literal list - but with a runtime mod?
Post by: BIGAL on June 25, 2021, 08:08:22 PM
Changing the width I use a STRLEN to work out how many characters, using a Foreach for a list getting the maximum number of characters then use a fuzz factor like 1.2 * length for width.
For a list box type dcl I use a library approach and demand load a predefined lisp. (if (not listbox)(load "listbox")) so only 2 line of code needed. I use one by AlanjT or another from Lee-mac.
Re library approach I have Multi getvals, Multi radio buttons, Multi toggles, all grow as required from a list so like 3 lines of code is all you need. A Multi column Radio buttons is being worked on now. Go Cadtutuor/downloads there free. All have example code in them.
Title: Re: How can I create a literal list - but with a runtime mod?
Post by: HeavyThumper on June 26, 2021, 02:12:40 PM