OptionList->Clear and OptionList->AddList

Started by Iulian, December 28, 2011, 09:50:15 AM

Previous topic - Next topic

Iulian

Hy,
I have a question about the Clear and AddList OptionList Methods:



First, I`have a modal form which contains two OptionLists.
OptionList1 has 4 (four) buttons, and OptionList2 has a variable number of buttons, dependent of the current selection of the OptionList2
For example, if:
OptionList1-ItemIndexOrCount is 0 (first button selected), OptionList2 has 4 (four) buttons;
OptionList1-ItemIndexOrCount is 1 (the second button selected), OptionList2 has 2 (two) buttons;
OptionList1-ItemIndexOrCount is 2 (the third button selected), OptionList2 has 1 (one) button.

For having this effect on the  OptionList2, I used in OptionList1_OnSelChanged the following:

(defun c:gaura_Form4_OptionList1_OnSelChanged (ItemIndexOrCount Value /)  
 
 (dcl_OptionList_Clear gaura_Form4_OptionList2); for having a blank list
 
 (cond ((= ItemIndexOrCount 0)  (dcl_OptionList_AddList gaura_Form4_OptionList2 "0buton1" "0buton2" "0buton3" "0buton4" ))
      ((= ItemIndexOrCount 1)  (dcl_OptionList_AddList gaura_Form4_OptionList2 "1buton1" "1buton2"  ))
      ((= ItemIndexOrCount 2)  (dcl_OptionList_AddList gaura_Form4_OptionList2 "2buton1"  ))
  );cond
 );defun OnSelChanged.



Having these inputs, when the OptionList1 button is changed, OptionList2 is correspondingly updated, BUT if the third button of Optionlist1 is selected after selecting the first button of OptionList1, the second and the third buttons (which should disappear) are still there. What should I do to fix my problem?

It is the same with the next example:

I have an OptionList and 2 (two) Text Buttons.
On Form_Initialize, I set the optionList "clear";
pressing TextButton1 a button is added onto the OptionList;
pressing TextButton2 a button is removed from the OptionList.

When I wont to remove a buton from the OptionList with TextButton2, the corresponding button can't be selected, but it is still there.


Thanks in advance.
Iulian.


I`m using the last version of OpenDCL (today downloaded), Windows 7 64bit, AutoCAD 2007



This a video which sustain my example:

OptionList Clear-fail.avi





owenwengerd

This sounds like an OpenDCL bug. To work around it, try assigning an explicit background color to the option list control. If that fails, you may have to call the Redraw method to force a redraw.
Owen Wengerd (Outside The Box) / ManuSoft

Iulian

Thank you owenwengerd.
It works by using the background color option list control. Is not necessary the redraw method (it works without it).