Error message with ListView

Started by Juerg W. Menzi, April 14, 2010, 01:30:06 AM

Previous topic - Next topic

Juerg W. Menzi

Hi to all

That's my first post in this forum - nice to see some known names...8-)

Ok, in short
ODCL is new for me, so I do my first steps with this product. Most of the
features are easy to handle, but then I got an error in a ListView and
I don't know what's the reason for:
Code (autolisp) Select

(defun WLK_0010 (Cus Cul / CusLst DefCus FrmNme HdrLst SelMde SelRec)
(setq FrmNme "frmSelPro"
      CusLst (mapcar '(lambda (l) (WLK_0014 (cdr l))) Cul)
      DefCus (cond ((LkListPos CusLst Cus)) (0))
      HdrLst (list
              (list (LkGetPrompt 0 137 0) 0 10)
              (list (LkGetPrompt 0 138 0) 0 10)
              (list (LkGetPrompt 0 139 0) 0 10)
              (list (LkGetPrompt 0 140 0) 0 10)
             )
      SelMde (atoi (LkGetAssoc "Lk:Mde" (cdr (nth DefCus Cul))))
      SelRec (atoi (LkGetAssoc "Lk:Rec" (cdr (nth DefCus Cul))))
)
(dcl_Form_Show Lk:Nme FrmNme)
(dcl_Control_SetTitleBarText Lk:Nme FrmNme (strcat Lk:Nme (LkGetPrompt 1 100 0)))
(dcl_Control_SetCaption Lk:Nme FrmNme "lblAppNme" (strcat Lk:Nme " " Lk:Ver))
(dcl_Control_SetCaption Lk:Nme FrmNme "lblCpyRgt" Lk:Cpr)
(dcl_Control_SetValue Lk:Nme FrmNme "optUseFld" SelMde)
(dcl_Control_SetValue Lk:Nme FrmNme "optUseFil" (boole 6 1 SelMde))
(dcl_Control_SetValue Lk:Nme FrmNme "chkRecFld" SelRec)
(dcl_Control_SetEnabled Lk:Nme FrmNme "chkRecFld" (= SelMde 1))
(dcl_ListView_AddColumns Lk:Nme FrmNme "lstSelPro" HdrLst) ;<-- Error line
(dcl_ListView_FillList Lk:Nme FrmNme "lstSelPro" CusLst)
(dcl_ListView_SetCurSel Lk:Nme FrmNme "lstSelPro" DefCus)
DefCus
)

Does somebody know what's the reason for this message?
The rest of the code works without any problems...

Thx, Jürg

Fred Tomke

Hi Jörg,

hello to this forum. At first something about special chars (like ä ö ü and so on): Have a look here to change the language of your profile to make sure that your name will be displayed correctly.

Are you sure that your ListView was named correctly?

What is the return of
Code (autolisp) Select
(eval (read (strcat Lk:Nme "_" FrmNme "_" "lstSelPro")))
when the form is shown?

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

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

Fred Tomke

In addition to my answer:

Whenever argument 0 is criticized the form cannot be found in the list of active forms or the control cannot be found in the list of child controls of the given form. Either the project isn't loaded yet, the form is not active yet or the form or control has another name as given.

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

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

Juerg W. Menzi

Hi Fred

Profile changed...

QuoteAre you sure that your ListView was named correctly?
Yes, see below

QuoteWhat is the return of
Code (autolisp) Select
(eval (read (strcat Lk:Nme "_" FrmNme "_" "lstSelPro")))
when the form is shown?
nil

I can't understand the fact that the other controls are working perfect, but not the ListView.

Thx for the quick response
Jürg

Fred Tomke

Yes, I'm sure you can get it after (dcl_project_load "myProj" T) or after restarting AutoCAD.
Why? Because (eval (read (strcat Lk:Nme "_" FrmNme "_" "lstSelPro"))) is nil in your case. You will see that (eval (read (strcat Lk:Nme "_" FrmNme "_" "optUseFil"))) is not nil.

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

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

Juerg W. Menzi

#5
Duhhh,

Shame on me, a typical beginner's mistake!
Instead using the VB form logic I had the stoneage DCL in my mind.
Have a look to the positon of '(dcl_Form_Show Lk:Nme FrmNme)' in my code...
OnInitialize was the magic word!

Sorry to keep you busy with my scrap! >:(
Cheers
Jürg

BTW, works now like a charm :D

owenwengerd

Welcome Jorg (BTW, your name still displays incorrectly for me). For what it's worth, the (dcl_Control_SetXxx) functions did not produce an exception because setting static control properties does not require an instance of the control. If, instead of the project/form/control method, you had used the Lisp variable to specify the control, those calls would also have resulted in exceptions because the variable's value is set only while the control exists.
Owen Wengerd (Outside The Box) / ManuSoft

Juerg W. Menzi

Hi Owen

Quote from: owenwengerd on April 14, 2010, 02:40:48 PM
Welcome Jorg (BTW, your name still displays incorrectly for me).
Hmmm, I've changed my profile as Fred recommended. The correct character is the umlaut ü (ue).
And...
thanks for your explanations about the odcl mechanism.

Cheers
Jüerg