dynamic control popup_list

dynamic control popup_list

Anonymous
Not applicable
1,475 Views
4 Replies
Message 1 of 5

dynamic control popup_list

Anonymous
Not applicable

Is there a way to dynamically control the popup_list inside a dcl file.  Once my AutoLisp file has determined the current month I would like the dcl file to reflect that as the first choice, but I would still like to be able to select a different month if it is necassary.  Any help would be greatly appreciated.

0 Likes
Accepted solutions (1)
1,476 Views
4 Replies
Replies (4)
Message 2 of 5

paullimapa
Mentor
Mentor
Accepted solution

This thread should answer your question:

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/value-from-popup-list/td-p/892851

Assuming your popup_list has key = "pop" then you simply use this code: (set_tile "pop" pop-value) ; where pop-value is a string value "0" is first position of the list, "1" is 2nd position of the list and etc.

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 5

scot-65
Advisor
Advisor
PLI has the correct answer.

As part of your LISP program, after declaring the new_dialog,
there *might* be a section which I call INITIALIZE. It comes before
the SET section.

Use the initialize section to determine what month you want to begin with.
In the set section, set_tile to the value.

By presetting tile values, where none exists beforehand, this will make
it easier to take that "snapshot" of the dialog when the accept button
is pressed, thus gathering all tile values and storing as a list for further
processing and/or "remember from last time" when reopening the dialog.

Program Structure:
new_dialog
Initialize
Set Tile
Mode Tile
Action Tile
start_dialog

Hope this helps.

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

0 Likes
Message 4 of 5

smaher12
Advocate
Advocate

Looking at the example from the link pli provided this is what I was able to come up with.

 

abc : dialog {
	 label = "Test Month DCL";

  spacer;
    :row {
	: boxed_column {
	  label = "Test Month";
	  width = 26 ;
	  fixed_width = true;

	  : popup_list { label = "Month :"; key = "pop"; edit_width = 8; }
  spacer;
	} // end boxed_column
    } // end row

    ok_cancel;
} // end abc dialog
(defun c:abc ()

  (setq dd (rtos (getvar "CDATE") 2 6)
        mo (substr dd 5 2)
  )

  (setq dcl_id (load_dialog "abc.dcl"))
  (if (not (new_dialog "abc" dcl_id))
    (exit)
  )

  (setq plist '("JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC"))

  (start_list "pop" 3)
  (mapcar 'add_list plist)
  (end_list)

  (if (= pop-value nil)(setq pop-value (itoa (- (atoi mo) 1))))
  (set_tile "pop" pop-value)

  (action_tile "pop" "(get-pop-value)")
  (action_tile "accept" "(done_dialog)")
  (action_tile "cancel" "(exit)")
    (start_dialog)
      (unload_dialog dcl_id)
 (princ)
) ;; end abc

(defun get-pop-value (/)
   (setq pop-value $value)
   (setq pop-item (nth (atoi $value) plist))
 (princ)
)
0 Likes
Message 5 of 5

Anonymous
Not applicable

Thanks all for the help, with some help from Jeffery Sanders I came up with the following code before I got the notification that anyone had responded here.  the code I used is -

 

(defun today ()

  (setq   d                 (rtos (getvar "cdate") 2 6)

  (setq monthadjust (itoa (- (atoi (substr d 5 2)) 1))

)

 

and the dcl code - 

(set_tile "monthlist" monthadjust)

 

Thanks again for all of your help, it fixed a frustrating problem for me.

 

Don

 

 

0 Likes