Overall Solution: Use labels, control grouping and a few lines of code to remove that dotted line focus indicator.
First, over the check box add a label with a caption of a space (" "). This prevents the label from disappearing when you click off of it.
Second, do an area select of the check box and label. From the menu bar, click Format, Group. This makes the check box and label a pair so you may change the design of your form as needed.
Third, in the OnClick event of the label add this line of code: chkToggle = Not chkToggle . This code will toggle between True and False.
<embed=snippet 197739>
This code will cycle between True, False and Null for a tri-state check box:
<embed=snippet 197743>
DONE!
1: 2: 3: 4: 5: 6: 7: 8: 9: | Private Sub lblCheckBoxToggle_Click()
If IsNull(chkToggle) Then
chkToggle = True
ElseIf chkToggle = True Then
chkToggle = False
ElseIf chkToggle = False Then
chkToggle = Null
End If
End Sub
|
1: 2: 3: | Private Sub lblCheckBoxToggle_Click() chkToggle = Not chkToggle End Sub |
First, the article agreement that was in place when articles first went live has been pulled by EE. Articles posted to the site now fall under the member agreement just as normal questions and comments do. With that, it means you own the content of the article (you can publish it else where), but EE has the right to use that content on experts-exchange indefinitely in what ever way it sees fit.
So with that change, if you are still willing, we would like to see your article get published. The MS Access Peer review group has looked over your article and made a few comments/suggestions on how it might be improved. Note that these comments and suggestions are just for you to help in making your article appeal to a wider audience. You do not have to use them and can publish the article in its current form if you wish.
Comments from the group:
- The code would be better off in the MouseUp event, I think. If a user clicks quickly, the double-click event fires, but the click event does not. I tried this in the mouse-down event as well, and found that I needed to click twice for changes to take place. (This is not that important, however - the checkbox behaves the same way as the label in this regard)
- It would be good to know exactly in which earlier versions of Access the Author has issues with the checkbox aesthetics. Fwiw, I tried comparing this method to an untouched checkbox in A2K3, and there was no perceptible difference. They both looked fine. A screenshot would be a good way of illustrating the issue.
Editor note: If you need help in creating screenshots, let me know - J Dettman.
- Stylistically, it would be good to see the three steps bulletized or otherwise separated.
Editor note: Help on formatting your article can be found here:
http://www.experts-exchang
- I would think it would be better if the code was refined to check if a check box was a triple state control or not. This way, you would only have one code snippet to on the label event. Also, mention should be made that in the control you need to change the name of the checkbox control in question, otherwise it won't work. Keep in mind that this is something a beginner might be attempting.
- The sentence "Overall solution" should be moved to the start of the article; it's a nice summary of what is going to happen.
- The article mentions placing a label control over the check box, but it does not mention that the background should be transparent. It also does not discuss 'z' order. If the checkbox ends up in front of the label because of editing at a latter time, the approach won't work.
- Might also want to mention that placing a label over something else is a general technique that can be used in a number of places (over a map or some other graphic) to create a hot spot.
- Should indicate at the start of the article what level of experience this applies to (beginner).
That sums up what everyone thought. Overall a nice article and with a little polishing, I think it will be a winner.
Jim Dettman
MS Access PE