Author Topic: Popup Box needing to be responsive to another popup box  (Read 174 times)

0 Members and 1 Guest are viewing this topic.

Kimpten

  • Mosquito
  • Posts: 6
Popup Box needing to be responsive to another popup box
« on: June 05, 2017, 07:49:39 am »
I attempted to search for answer and could not find an answer so now I am asking for help. I am just learning lisp and DCL and I have just jumped into the deep end. I have a popup box that has been filled in with the Printer list with System printers turned on. I also have a popup box that has the paper size list. What I am wanting is the paper size list to update based on the printer that is selected in printer list popup box. Essentially if I pick a printer that can not print 11x17 or even a larger size, I dont want to be presented those options. I see that it should be possible as the plot dialog box that is included in AutoCAD has this ability to be responsive. I can get both popup lists to fill in individually just not responsive. Below are some snippets of the Lisp and DCL in question. The lisp is not completed as of yet so if I post fully what I have it may be even more confusing.

Code: [Select]
: row {
: popup_list {
key = "printerlist";
label = "Printer/Plotter";
width = 20;
fixed_width_font = false;
value = 0;
}
: row {
: popup_list {
key = "papersizelist";
label = "Paper Size";
width = 20;
fixed_width_font = false;
value = 0;
}
}
Code: [Select]
(setq AcadDoc (vla-get-activedocument (vlax-get-acad-object)))
(setq ModelLayout (vla-item (vla-get-layouts AcadDoc) "Model"))
(setq NamedViews (vla-get-views AcadDoc))
(setq RefreshList (vla-RefreshPlotDeviceInfo ModelLayout))
(setq PrinterList
(vl-remove-if '(lambda (x) (wcmatch x "None"))
(vlax-safearray->list
(vlax-variant-value
(vla-getplotdevicenames ModelLayout)
)
)
)
)
(setq PaperSizeList
(vl-remove-if '(lambda (x) (wcmatch x "None"))
(vlax-safearray->list
                        (vlax-variant-value
(vla-GetCanonicalMediaNames ModelLayout)
)
)
)
)
(start_list "printerlist")
(mapcar 'add_list PrinterList)
(end_list)
(start_list "papersizelist")
(mapcar 'add_list PaperSizeList)
(end_list)

Thanks,

steve.carson

  • Newt
  • Posts: 46
Re: Popup Box needing to be responsive to another popup box
« Reply #1 on: June 05, 2017, 12:31:28 pm »
Lee Mac put together a tutorial for this very thing:

http://www.lee-mac.com/listboxsync.html


Lee Mac

  • Seagull
  • Posts: 11698
  • AutoCAD 2015 Windows 7 London, England
Re: Popup Box needing to be responsive to another popup box
« Reply #2 on: June 05, 2017, 12:37:47 pm »
Thanks Steve.

There is also the following generic function for any number of inter-dependent DCL list tiles:

http://lee-mac.com/listtiledependency.html

Kimpten

  • Mosquito
  • Posts: 6
Re: Popup Box needing to be responsive to another popup box
« Reply #3 on: June 05, 2017, 01:46:12 pm »
I will look over those two links and see if I can get this figured out. Thanks for the help.

Kimpten

  • Mosquito
  • Posts: 6
Re: Popup Box needing to be responsive to another popup box
« Reply #4 on: June 06, 2017, 07:35:08 am »
Using these examples I was able to get the list to update each time I selected a different printer. However, the method I currently am using is apparently not checking if the printer can even print that size and is outputting the entire list of possible options still. I will have to look into this further when I have more time.

Thanks for the help.