Conditionally Enable Simulated Checkbox Implemented as a Class (1 Viewer)

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:46
Joined
Jan 20, 2009
Messages
12,852
The attached demo is my version of a simulated checkbox with conditional enabling implemented using a Class.

It is precisely designed to emulate the focus behaviour of a checkbox.

It shows little bit of flicker on update but I think that is not unusual with Conditional Formatting.
 

Attachments

  • SimulatedCheckboxDemo.mdb
    296 KB · Views: 796

jdraw

Super Moderator
Staff member
Local time
Today, 05:46
Joined
Jan 23, 2006
Messages
15,378
Galaxiom,

I got the attached error on opening??
Is there more documentation for this class?
 

Attachments

  • SimError.PNG
    SimError.PNG
    9.1 KB · Views: 370

Gasman

Enthusiastic Amateur
Local time
Today, 10:46
Joined
Sep 21, 2011
Messages
14,260
Just found out about this via two other threads.

DB works fine for me Jack, in that it opens and the checkboxes are set and cleared.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:46
Joined
Jan 20, 2009
Messages
12,852
I got the attached error on opening??
Is there more documentation for this class?
IIRC there is a loop that removes any existing conditional formatting. Maybe there is a problem there.
There is no validation of the controls in the parameters. Maybe you have passed a control that does not support conditional formatting.

It you turn on Break in Class Module in VBA editor it should show you exactly where it goes wrong.

Unfortunately I have not further documented it. The class itself needs more work such as the validation of the parameters.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:46
Joined
Feb 19, 2002
Messages
43,257
I got the same error when I opened the db. Then the db opens and seems to work. If I set conditional formatting on the control, I get the error again. It happens in:

Public Property Set SimLabel(ByRef ctrl As TextBox)

And the Resume ExitPoint line is highlighted when I use cntl-break. When I add a resume so I can get back to the actual error it is -

For n = cbtxtLabel.FormatConditions.Count To 0 Step -1
cbtxtLabel.FormatConditions(n).Delete <<<===== highlighted
Next
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:46
Joined
Sep 21, 2011
Messages
14,260
Oh, I did not play around with any CF.
Merely opened the DB.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:46
Joined
Jan 20, 2009
Messages
12,852
For n = cbtxtLabel.FormatConditions.Count To 0 Step -1
cbtxtLabel.FormatConditions(n).Delete <<<===== highlighted
Next
It needs a test to check if there is any existing ConditionalFormatting on the control. The error is thrown when there isn't any.
 

Users who are viewing this thread

Top Bottom