dcl_ComboBox_AddList

Started by topograph, January 10, 2012, 06:05:48 AM

Previous topic - Next topic

topograph

Hello to all and happy New Year:)

I am OpenDCL rookie and OpenDCL Runtime [7.0.0.2] does not work the way I want :oops:
What is wrong in my code:

Code (autolisp) Select

(setq lst (list "A" "B" "C"))
(dcl_ComboBox_AddList MyComboBox lst)

returns an empty ComboBox list (???)

Code (autolisp) Select

(dcl_ComboBox_AddList MyComboBox (list "A" "B" "C"))

works OK.

Who is making a mistake, me or OpenDCL Runtime?

owenwengerd

Quote from: topograph on January 10, 2012, 06:05:48 AM
Who is making a mistake, me or OpenDCL Runtime?

The odds are not in your favor, but you'll need to provide more information (such as a simple .odcl file and .lsp) to demonstrate the problem.
Owen Wengerd (Outside The Box) / ManuSoft

topograph

#2
Quote from: owenwengerd on January 10, 2012, 11:04:18 AM
The odds are not in your favor...

...as usual, when my lisps is not working well:)

I figured, both work well, I'm wrong because I do not know all the events and methods of the ComboBox control.

I tried to do this:
Code (autolisp) Select

(defun C:test (/ cmdecho)
 (setq cmdecho (getvar "CMDECHO"))
 (setvar "CMDECHO" 0)
 (command "_OPENDCL")
 (dcl_Project_Load "D:\\MyProject.odcl")
 (dcl_Form_Show Form1)
 (setq lst1 (list "1" "2"))
 (setq lst2 (list "a" "b" "c" "d"))
 (setq lst3 (list "e" "f" "g" "h" "i"))
)


What is the next step?

Sorry for my bad lisp/OpenDCL, I am not programmer.

owenwengerd

You did a good job of creating a simple example, except I think you forgot to include code that shows the actual problem.
Owen Wengerd (Outside The Box) / ManuSoft

topograph

#4
Yes, I made a good job of simple example with copy/paste/edit method:), but I do not know next steps.
I tried this code but not working
Code (autolisp) Select

(defun c:ComboBox1_OnSelChanged (ItemIndexOrCount Value /)
 (cond
   ((= (dcl_ComboBox_GetEBText ComboBox1) (car lst1))  ;when I select 1st item
     (dcl_ComboBox_AddList ComboBox2 lst2)             ;I want to put members of the lst2 as items of ComboBox2
   )
   ((= (dcl_ComboBox_GetEBText ComboBox1) (cadr lst1)) ;when I select 2nd item
     (dcl_ComboBox_AddList ComboBox2 lst3)             ;I want to put members of the lst3 as items of ComboBox2
   )
 )
)


I got result from the pictures so I put in the LIST Property of ComboBox2 (in Studio/Dialog Editor) content of lists lst2 and lst3 (with "|" separator") but my wish is to do this from my lisp.

Sorry for my "Google translator English" but I hope you understand me;)

owenwengerd

Your English is fine. First, make sure the event name set in the .odcl matches the function name. Next, set your lst1, lst2, and lst3 variables *before* you call (dcl_Form_Show). Then, I think it will work as you expect.

By the way, I think that you probably want to use 'Value' instead of '(dcl_ComboBox_GetEBText ComboBox1)' in your event handler.

I hope that helps.
Owen Wengerd (Outside The Box) / ManuSoft

topograph

Yes, it works (I think I'll have to modify my lisp, but that's it). Thank you for your time Owen.