|
-
Jul 14th, 2000, 05:10 AM
#1
Thread Starter
Hyperactive Member
in my app, i've got a check box placed on a command button. the command button displays/hides a large text box used for entering/editing client notes. if there are already notes, the check box is checked, if the notes are empty, there will be no check
all of this works fine, but I want to stop the check box from being changed when it's clicked on. i came up with the following sub: -
Public Sub CheckBoxClick(Ctrl As Control)
'stop a check box responding to being clicked on
With Ctrl
If .Value = 1 Then
.Value = 0
Else
.Value = 1
End If
End With
End Sub
and in the click event of the check box, i put : -
Private Sub chk_Notes_Click()
CheckBoxClick chk_Notes
End Sub
the reason i did it this way is that i have lots of occasions where i have check boxes used simply as indicators
the only problem being when i call the sub, i get runtime error 28 - out of stack space. the only reason i can think of is that when i set the value of the check box, the click event is being called ad infinitum.
i've tried disabling the check box, but they look horrible then.
what's the best way of doing this - it doesnt have to be a check box on the button, as long as it looks obvious that there are or are not notes to be viewed.
[Edited by Jimbob on 07-14-2000 at 06:15 AM]
-
Jul 14th, 2000, 05:17 AM
#2
Fanatic Member
This will stop a check box changing when you click on it.
Code:
Private intState As Integer
Private Sub CheckBox_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
intState = CheckBox.Value
End Sub
Private Sub CheckBox_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
CheckBox.Value = intState
End Sub
-
Jul 14th, 2000, 05:24 AM
#3
Addicted Member
Could you not change the Caption or Colours of the button at run-time? ie:
if (notes_exist) then
button.caption = "XXXX (Notes)"
button.background or font = red
else
button.caption = "XXXX"
button.background or font = normal
end if
Not proper code, but might give you the gist...
-
Jul 14th, 2000, 05:30 AM
#4
Thread Starter
Hyperactive Member
cheers, both of you - plenty of ideas now!
ps, stevie
this may be a stupid question, but how did you indent your block of code, every time i paste it in, it all aligns to the left margin
-
Jul 14th, 2000, 05:34 AM
#5
Fanatic Member
Place code and /code around your code.
Both need square brackets around them.
-
Jul 14th, 2000, 07:57 AM
#6
Click here to see a list of all the vBulletin tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|