BlockView-PreLoad will not work the way I expected

Started by glfiedler, January 29, 2024, 02:34:41 PM

Previous topic - Next topic

glfiedler

Greetings,
I run AutoCAD 2022 and the latest version of OpenDCL.

I have created a Modal form with listbox and blockview controls.  What I want to do is select from a list of blocks and show the block in the blockview control.  That seems really straight forward.

I have blocks in what I call a library drawing. (setq libdwg "C:\\Users\\jerry\\Drawings\\MISC_BLOCKS\\ROUTER.dwg").  The OpenDCL help (which is very good and usually helps a lot) leads me to believe that (dcl-BlockView-PreLoadDwg RouterBitsDB/Form1/BlockView1 libdwg) will allow me to show the blocks in the blockview control.

It does not work like that and I really need some ideas. The following two cases will show you what happens:

1) With libdwg OPEN and as the ACTIVE drawing and the DCL routine does NOT contain the PreLoad command the form does EXACTLY what I want.  That is, I click on an item in the list and the block is shown.

2) With libdwg CLOSED and another drawing active and the DCL routine DOES contain the PreLoad command the form opens and the listbox works fine but nothing is displayed in the blockview control.

I am obviously doing something wrong and my knowledge of OpenDCL is limited.  Although I have been programming for decades I have only just started to learn OpenDCL.
Reviewing the two tests, above, it would appear that I am calling out the library drawing incorrectly and it is simply defaulting to the active drawing.

Thank you for taking the time to read this post.
Regards,
Jerry

glfiedler

Okay I got it working.  I was using (dcl-BlockView-Clear RouterBitsDB/Form1/BlockView1) to clear the view.  I thought that might be a good idea.  The OpenDCL help states "This method resets the control and clears the display."  I had no idea what "resets" was implying but it apparently resets i.e. deletes the PreLoad file reference.  I do not really need to clear the view so by eliminating the "clear" command all is well.
Learn something new every day!