The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
TCheckBox Enable/Disable issue
Posted: 05 Feb 07 10:12 AM
|
fiogf49gjkf0d HI all: I'm trying to use a check box and part of my requirement is to be able to enable/disable the control based on specific criterias. That property, however, does not seem to work and, there does not seem to be a ReadOnly property I could use. Has anyone found a solution/work around for this issue?
Tanks in advance |
|
|
|
Re: TCheckBox Enable/Disable issue
Posted: 05 Feb 07 12:10 PM
|
fiogf49gjkf0d Hi Luc,
I hope my understanding of your problem is correct: you can enable/disable a Checkbox control with Checkbox.Enabled = TRUE or CheckBox.Enabled = FALSE (to disable it). I found no problems on my SLX version 6.2.3. Maybe there is an other error in your script.
Maybe you should post your code.
Best regards, Thomas |
|
|
|
Re: TCheckBox Enable/Disable issue
Posted: 05 Feb 07 12:16 PM
|
fiogf49gjkf0d Hi Thomas, thanks for your reply. I later found that the error was not a defect on the control itself. Rather, it was the delay it takes the form to load. I believe the form load event fires before all of the controls have been 'loaded'. This, I believe, is causing the code to disable the control before it gets loaded with the default of "Enabled = True". I have added a timer to wait 300 milliseconds before it disables the form and it seems to be OK now. It's kind of a bogus fix but it works. FYI: I am using version 6.2.3.1156 |
|
|
|
Re: TCheckBox Enable/Disable issue
Posted: 05 Feb 07 1:41 PM
|
fiogf49gjkf0d Try using OnChange. This event occurs after all of the form's controls are created and database values are passed to the binded properties. As a general rule, I stick to using OnChange versus OnCreate. OnCreate is almost never necessary, as you never really need to inject control code that high up into the loading process. |
|
|
| |
|
Re: TCheckBox Enable/Disable issue
Posted: 06 Feb 07 6:42 AM
|
fiogf49gjkf0d Actually, the only way that I have found to truly control the read-only aspect of a checkbox is to put it on a small panel, then control the read-only of the panel itself. BTW, when you deselect enabled, the checkbox is grayed out and hard to read. By using the panel's read-only property, you can still easily see the value in the checkbox without the ability to change it when the panel's read-only property is true. You can change change panel's bevel properties to none so that it is virtually invisible to the user.
Regards, LaNae |
|
|
| |
|