question about Checkbox

Started by Iulian, March 22, 2010, 06:24:16 AM

Previous topic - Next topic

Iulian

On my modeless form I have a few tools ( Option Lists, Frames, Check Boxes etc.)...
I made this procedure: when the CheckBox1 (cb1) is checked the OptionList1(OL1) appears, and when the CheckBox1 is unchecked the OptionList1 is hidden.

OnInitialize event I have set up the Long Value of the CheckBox1 on zero ( what means UNCHECKED), and (dcl_Control_SetVisible Proj_Form1_OptionList1 NIL), to have hidden the OptionList1, and UNCHECKED the CheckBox1.

Now, when I run my project, CheckBox1 is CHECKED, and OptionList1 VISIBLE, although  these were been set up in ONINITIALIZE event of the form1.

What I have remarked, is that after form1 appears, my CheckBox1 is selected...like in picture below....
After that, I putted another CheckBox  (Checkbox2) on my form1, and after project runs, Checkbox2 was selected (I think because was the last putted on the form..),  and my settings from the ONINITIALIZE event of form1 were OK...After that, I have erased the last CheckBox  (cb2), and CheckBox1 were again checked, how it should not be...

What I should do for overseen the selection, on ONINITIALIZE event? because I think this cause my problem...
Thanks.

owenwengerd

Can you upload a simple form and lisp file that demonstrates the problem?  Which version of OpenDCL are you using?
Owen Wengerd (Outside The Box) / ManuSoft

Iulian

This is a simple example...if CheckBox is first in Z/tab order, goes wrong, and for example if Close button is first, everything is OK.
I`m using  OpenDCL.Studio.ENU.6.0.0.23.msi
Thanks.

owenwengerd

I cannot reproduce the problem in AutoCAD 2010 on Windows 7 x64.  Can you test on another computer to see if the problem is reproducible on more than 1 computer?
Owen Wengerd (Outside The Box) / ManuSoft

Iulian

I run the project on 3 different PC, all with Windows XP x 32, with AutoCAD 2007 and AutoCAD 2005...all with the same  OpenDCL.Studio.ENU.6.0.0.23.msi alpha version.
The same result..

owenwengerd

Hopefully someone else will test your sample and let us know whether they have the same problem.
Owen Wengerd (Outside The Box) / ManuSoft

BazzaCAD

Try removing the t reload option from this line:

(dcl_project_load "example" t)
(dcl_project_load "example")
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

BazzaCAD

#7
Also, these lines don't look right:

Code (autolisp) Select

(defun c:example_Form1_CheckBox1_OnClicked (Value /)
   (setq cb_value (dcl_Control_GetValue example_Form1_CheckBox1))  ;;;; <---- you don't need this line, use the Value passed in by the OnClick function

 (cond ((= cb_value 0)
((dcl_Control_SetVisible example_Form1_OptionList1 NIL))  ;;; <--- too many ()
       )
   
       ((= cb_value 1)
((dcl_Control_SetVisible example_Form1_OptionList1 T))   ;;; <--- too many ()
       )  
)
)


Try this:
Code (autolisp) Select

(defun c:example_Form1_CheckBox1_OnClicked (Value /)
 (cond
   ((= Value 0)
(dcl_Control_SetVisible example_Form1_OptionList1 NIL)
    )
    ((= Value 1)
(dcl_Control_SetVisible example_Form1_OptionList1 T)
    )
 );_ cond
);_ defun


a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

Barry, are you able to reproduce the OP's problem?

BTW, this would be my version:
Code (autolisp) Select

(defun c:example_Form1_CheckBox1_OnClicked (Value /)
  (dcl_Control_SetVisible example_Form1_OptionList1 (= Value 1))
);_ defun
Owen Wengerd (Outside The Box) / ManuSoft

BazzaCAD

Quote from: owenwengerd on March 23, 2010, 10:26:23 AM
Barry, are you able to reproduce the OP's problem?

I didn't try it yet, since I'm on Win7 & Acad2010. I can try on an other XP machine wit hAcad2008 & 2010 late....
But since it sounded like an issue with reshowing the form & ONINITIALIZE even I thought it might be the reload flag...
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

Since the checkbox state is being set in OnInitialize, the initial value (and hence reloading) shouldn't matter one way or the other.  In any case, I hope you get a chance to test it on both systems.
Owen Wengerd (Outside The Box) / ManuSoft

Iulian

Thank you guys for your interest ... I tried all your alternatives, and the result is the same... the single way to resolve this is to put the checkbox in the bottom of the Z/Tab order list...As long as it works...it`s ok.
Thank you again !

owenwengerd

Quote from: Iulian on March 24, 2010, 02:21:17 AMAs long as it works...it`s ok.

Hopefully we can track down the cause in case there's a bug hidden somewhere.
Owen Wengerd (Outside The Box) / ManuSoft

c2k

I am having similar problems with what seems like the oninitialize not working with check boxes.  Thought I should mention I am using Windows 7 64 bit.
Mine is a modal form.  I have a picture box at the front of the Z order and a few check boxes following.  The first check box seems to ignore my oninitialize code.  And as Iulian stated, if I put a button before the check box in the Z order, the check boxes initialize as expected.  It seems the object before the check box needs to have an event or the work around has no effect as my picture box made no difference.
**CHRIS
Windows 7 64-bit
AutoCAD Revit MEP Suite 2010

owenwengerd

Can you upload a simple project that demonstrates the problem?
Owen Wengerd (Outside The Box) / ManuSoft