DCL Popup_list simple question

DCL Popup_list simple question

rapidcad
Collaborator Collaborator
1,557 Views
3 Replies
Message 1 of 4

DCL Popup_list simple question

rapidcad
Collaborator
Collaborator

Hi all, at least I think this is a simple question to a problem I don't see (or understand exactly).

 

I have been trying to make this interface for a program I cobbled together but I can't see my mistake with the Popup_list and Edit_box. The program actually works exactly as I want it to if the user picks a different control AFTER using the Create Layer or Select Existing Layer option, but if they use these last, the variable fails to get set. What am I missing? I have to admit this is got me stuck. I've tried hundreds of variations and still don't know how to get the Popup_list and Edit_box to read immediately after setting.

 

Any help greatly appreciated.

 

 

ADN CAD Developer/Operator
0 Likes
Accepted solutions (1)
1,558 Views
3 Replies
Replies (3)
Message 2 of 4

scot-65
Advisor
Advisor
Accepted solution
Try:
(Setq layer_list (layers_ok))
(mapcar 'add_list layer_list)
(end_list)
To:
(start_list "layer_pop_list")
(mapcar 'add_list (layers_ok))
(end_list)
group all these together with nothing in between (you have a
function "layers_ok" here).

I see many of these:
(set_tile"A" "1")
To:
(set_tile "A" "1")

If you wish to highlight (/set focus) to the/an edit box,
use mode_tile 2. [I have not looked at the DCL]

Possibly?
(saveVars)
(start_dialog)
To:
(action_tile "accept" "(saveVars)(done_dialog 1)")
(setq sd (start_dialog))
The integer return of done dialog is captured by sd and can
be used as a test when entering the main execution portion
of your program. As long as the accept line above is used,
there is no need to save vars during the run time of the dialog.

Is there any allow_accept to any of the tiles? I would suggest
removing these as well.

Inside the saveVars sub, build a list. This method will create one
variable that can be accessed using nth (zero-based).

What is "(165modes)"?

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 4

rapidcad
Collaborator
Collaborator

Thanks so much Scot! 

You nailed it with:

 (saveVars)
(start_dialog)
To:
(action_tile "accept" "(saveVars)(done_dialog 1)")
(setq sd (start_dialog))

The fix was associating the action_tile with the (saveVars) function and done_dialog, I think.

The other things may not program the way you would arrange them but they work fine anyway. Seems like everyone has a different way of thinking through a program. My ways are definitely not elegant or efficient - usually simple and sometimes crude, but hopefully robust and not taxing enough to slow down AutoCAD.

As for the lack of spaces in the set_tile calls, those are hangers-on from a long ago method a really good programmer taught me to do. He wanted no spaces in his lisp if they weren't needed and this chunk of code started with a grab from that old stuff. I realize now that spaces help us read them so much better and AutoCAD and computers aren't nearly as hard-up for memory as they were then, so I fixed them.

I removed the (saveVars) function calls except at the action_tile accept and you were correct as well - works just fine.

I tried the following...

Try:
(Setq layer_list (layers_ok))
(mapcar 'add_list layer_list)
(end_list)
To:
(start_list "layer_pop_list")
(mapcar 'add_list (layers_ok))
(end_list)
group all these together with nothing in between (you have a
function "layers_ok" here).

...but that messed up the layer selection by addressing the wrong index of the list (or the wrong list) and consistently gave me the wrong layer. That layers_ok function supplies me with a short list of usable layer names instead of the whole list. I think your recommendation somehow references the wrong list or keyword.

The defun  "(165modes)" just sets a list of 3 variables that get read at the end of my actual program. The TEST1 lisp only includes the interface stuff so I could keep the focus on the data gathering problem.

Thanks again Scot - you showed me a much better method I will try to fully understand and continue using.

ADN CAD Developer/Operator
0 Likes
Message 4 of 4

scot-65
Advisor
Advisor
Good to see that you moved the function outside of
(new_dialog... and ...start_dialog).

I'm not sure if I had ever tried to call a function during 'add_list.
It looks as if you verified that it does not work.

(start_list "layer_pop_list" 3)
^^^ I would switch these lines VVV
(Setq layer_list (layers_ok))
(mapcar 'add_list layer_list)
(end_list)

I'm having a hard time distinguishing between an initialization
section of code and the actual "main program". This is where sd
will come into play:

(if (> sd 0)
(progn
...Main Program
);progn
);if

Had you a cancel button, the line above start_dialog would be:
(action_tile "cancel" "(done_dialog 0)")
and the program would not enter the main.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes