Home Tour! Products Download Purchase Support Company Contacts  

Question

I am trying to create a dockable dialog that loads everytime AutoCAD starts up. I can get the dockable dialog to show up and all the buttons work, but none of the ComboBoxes get filled from the OnInitialize event. The drop down lists are blank. When startup the dockable dialog after AutoCAD starts the ComboBoxes are filled. I used the defun-q S::STARTUP command to start my command. Any ideas?

Answer

What is happening is that the OnInitialize event is being fired but because AutoCAD is starting up the Event cannot be fired at that point. Below is the coding that needs to be used to ensure your Initialization is completed. This answer is also usable for Modal and Modeless dialog boxes as well.

; when AutoCAD starts up
(defun-q S::STARTUP ()
; call defun to create the dockable dialog box
(c:doctest)
; call the OnInitialize defun here because ObjectDCL can't fire it at this point in the AutoCAD loading proceedure.
(c:DclForm5_OnInitialize)
)

; command to activate sample Dockable Dialog Box
(Defun c:doctest ()
(objectdcl_loadarx)
(Odcl_LoadProject "Test.ods" T)
(Odcl_Form_Show Test_DclForm5)
(PRINC)
)

; event defun for OnInitialize
(defun c:DclForm5_OnInitialize ()
(Odcl_ComboBox_AddString Test_DclForm5_ComboBox1 "1")
(Odcl_ComboBox_AddString Test_DclForm5_ComboBox1 "2")
(Odcl_ComboBox_AddString Test_DclForm5_ComboBox1 "3")
(Odcl_ComboBox_AddString Test_DclForm5_ComboBox1 "4")
)
Home Products Download Purchase Support Company Contacts