Problem with TAB STRIP lsp code

Started by kruuger, May 11, 2009, 12:04:22 PM

Previous topic - Next topic

kruuger

Hello Everyone

I work a little with standard autocad DCL. Now i want learn OpenDCl. It is more powerfull then standard DCL

I try to make 3 Tab Strips with CHANGE event. I wrote lisp code but something is wrong. When i changing tabs, defined list ONE TWO THREE doesn't load to ListBox.
What is wrong?
Also OK and CANCEL button are not working.

Here is lisp code:
Code (autolisp) Select
(DEFUN c:TTT ()
 (or LoadRunTime (load "_OpenDclUtils.lsp") (exit))
 (LoadRunTime)
 (LoadODCLProj "Test.odcl")
 (dcl_FORM_SHOW Test_LISP_FORM)
 (setq ONE (list "1" "2" "3"))
 (setq TWO (list "4" "5" "6"))
 (setq THR (list "7" "8" "9"))
 (princ)
);LISP

(defun c:Test_LISP_FORM_OK_OnClicked ()
 (dcl_Form_Close Test_LISP_FORM)
)

(defun c:Test_LISP_FORM_CANCEL_OnClicked ()
 (dcl_Form_Close Test_LISP_FORM)
)

(defun c:Test_LISP_FORM_TABS_OnChanged (ItemIndex)
 (cond
   ((= ItemIndex 0) (dcl_ListBox_AddList Test_LISP_FORM_ListBox1 ONE)
   )
   ((= ItemIndex 1) (dcl_ListBox_AddList Test_LISP_FORM_ListBox2 TWO)
   )
   ((= ItemIndex 2) (dcl_ListBox_AddList Test_LISP_FORM_ListBox3 THR)
   )
 );cond
)


And here .odcl file
http://home.autocom.pl/kruuger/FTP/Lisp.odcl

Thx
Best regards
Kruuger

owenwengerd

I see several problems.

1) You are not setting ONE, TWO, and THR until after the form is dismissed. Since tyhese are used by the form's event handlers, they should be set before the call to (dcl_form_show).

2) The event handler function names do not match the function names in the .odcl file. With the .odcl file open in studio, highlight each event in the events tab, then copy and paste the event handler name from the field below the events list into your lisp code.

3) The symbol used as the firsta rgument to (dcl_ListBox_AddList) is not correct. Change that to Lisp_LISP_FORM_ListBox1. This likely happened because you renamed the .odcl file.

kruuger

Thanks for quick answer.

You are right with point 2. It was the main problem. I knew that it i would a problem with DCL component naming.
I need to be VERY VERY careful with that next time.

THX