error msg: Exception in dcl_Form_Show ARX Command

Started by paul_s, October 02, 2009, 11:39:19 AM

Previous topic - Next topic

paul_s

Hello,

I am having problems with some of my old projects with Autocad 2010 and
latest opendcl runtime. I've tried saving the projects with the latest
editor but still gives me problems. It first gives me this error message,
then kicks me out autocad.

The purpose of my project is to quickly open drawings in a predetermine
location. If I open a drawing by double clicking the drawing preview, then
close that drawing it would give the error message then kick me out.

However, it does not kick me out if I open a drawing by double clicking
the drawing preview, switch to a different drawing then switch back to
that drawing I opened and then close it.

Please create a folder in your C drive and call it "temp" then copy a couple
of drawings into it.


Fred Tomke

Hi, welcom to the board.
I've tried your example. I get no error (with AutoCAD 2008). But I do wonder that it sould work at all. In my opinion it shouldn't never work with modal forms (unless you close the form). Try it with a non modal form. That should work!

Give me some minutes for an example.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

BazzaCAD

Hmmmm, did you check out the Migration guide I referred you to in your last post?
http://opendcl.com/wordpress/?page_id=10

I just took a quick look at you code so far and found a few issue.
1. Change (dcl_LoadProject) to (dcl_Project_Load)
2. Dbl. Clicking on the preview doesn't work.
This is b/c you have the "OnClicked" event checked, not the "OnDblClicked"

I'll keep playing and see if I can reproduce the crash...
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Fred Tomke

Hi, paul_s,

I got it!

At first: You missed to activate the OnDblClicked event, but that's not the key.  ;)
You did something I described some days ago. The problem is here:

Code (autolisp) Select

(defun c:QLook_QLook_DwgPreview1_OnDblClicked ( / rvalue)
(Setq rValue (Dcl_DwgPreview_GetDwgName QLook_QLook_DwgPreview1))
(Dcl_Form_Close QLook_QLook)
(vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) rvalue))
); c:QLook_QLook_DwgPreview1_OnDblClicked


You must leave the event function to give back control to AutoCAD at first.
My posting you will find here.

I will try to change the code that it works for you.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

BazzaCAD

OK I was able to get your code to load & reproduce the error.
It does close the form before opening the next DWG, but if you close that DWG, you get the error in the first DWG.
Maybe Owen can see if this is a bug. Use my code as it's working out of the box.
But like Fred said, it'll probably work if you use Modeless forms.
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

BazzaCAD

I'll let Fred take over, as he's the expert in this area.. :)
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Fred Tomke

Hi, paul_s, here it is and it works with your project file without any change. I tried it successfully with Acad2008 on XP and Map 2010 on Vista.

Code (autolisp) Select

(defun c:Test ( / c:QLook_QLook_OnInitialize c:QLook_QLook_DwgPreview1_OnDblClicked
                  c:QLook_QLook_TextButton1_OnClicked c:QLook_QLook_ListView1_OnClicked
                  intReturn temp_folder oDoc strFileToOpen)
  ;; define event functions

  (defun c:QLook_QLook_OnInitialize (/ dwg_list)
    (Dcl_ListView_Clear QLook_QLook_ListView1)
    (Dcl_ListView_AddColumns QLook_QLook_ListView1 (list (list "Drawings   " 0 600)))
    (setq dwg_list (vl-directory-files temp_folder "*.dwg" 1))
    (if (/= dwg_list nil)
      (foreach N DWg_List
        (Dcl_ListView_AddItem QLook_QLook_ListView1 0 (strcat temp_folder "\\" N))
      ); foreach
    ); if
  ); c:QLook_QLook_OnInitialize

  (defun c:QLook_QLook_DwgPreview1_OnClicked ( / rvalue)
    (Setq strFileToOpen (Dcl_DwgPreview_GetDwgName QLook_QLook_DwgPreview1))
    (Dcl_Form_Close QLook_QLook 1) ;; <-- set return value here, 2 is reserved for ESC
  ); c:QLook_QLook_DwgPreview1_OnClicked

  (defun c:QLook_QLook_TextButton1_OnClicked (/)
    (Dcl_Form_Close QLook_QLook 0)
  ); c:QLook_QLook_TextButton1_OnClicked


  (defun c:QLook_QLook_ListView1_OnClicked (Row Column / sSelText)
    (Setq sSelText (Dcl_ListView_GetItemText QLook_QLook_ListView1 Row Column))
    (Dcl_DwgPreview_LoadDwg QLook_QLook_DwgPreview1 sSelText)
  ); c:QLook_QLook_ListView1_OnClicked


 
  (Setq temp_folder "c:\\temp")
  (Dcl_LoadProject "QLook.odcl" T)
  (if (and (= (setq intReturn (Dcl_Form_Show QLook_QLook)) 1)  ;; return value from close method
           strFileToOpen (findfile strFileToOpen)
           (setq oDoc (vl-catch-all-apply 'vla-open (list (vla-get-documents (vlax-get-acad-object)) strFileToOpen)))
           (not (vl-catch-all-error-p oDoc)))
    (vla-Activate oDoc)
  ); if
  (princ)
); c:Test

(vl-load-com)


Hope that helps a bit.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Fred shall be known henceforth as the official OpenDCL FormClose expert. ;)
Owen Wengerd (Outside The Box) / ManuSoft