vanoverp
asked on
Is it possible to lock (not disable) checkbox, option button, and mask edit controls?
I have a client that is very upset because when these 3 types of controls are disabled, they can't read the hazy gray text.
Is there some trick that I can use to LOCK these controls, like you do text box and combo box controls?
SendMessage API call maybe? Any ideas?
Thanks, paul
Is there some trick that I can use to LOCK these controls, like you do text box and combo box controls?
SendMessage API call maybe? Any ideas?
Thanks, paul
ASKER
The trick is that I am trying to lock these controls from within a generic script. It loops through a control array of the controls on the form, checking to see what each control is. For example, if it is a textbox, it will lock it.
So, modifying the code for each individual control is not an option at this point.
Sorry I forgot to mention that.
Thanks, paul
So, modifying the code for each individual control is not an option at this point.
Sorry I forgot to mention that.
Thanks, paul
how about Text1.Locked = True
ASKER
I am talking about checkboxes, option button, and the masked edit control. Not Text Boxes. Text Boxes will allow the Locked property to be set with no problem.
But the other 3 controls do not have a locked property.
A person from Microsoft has suggested that I dynamically create a frame on the screen during run time and make these controls Container Property the frame that I create. Then I can just disable the frame as a whole. THis will supposedly prevent the controls from turning gray, but it will disable them
I will try this when I can and go from there. Thanks!
But the other 3 controls do not have a locked property.
A person from Microsoft has suggested that I dynamically create a frame on the screen during run time and make these controls Container Property the frame that I create. Then I can just disable the frame as a whole. THis will supposedly prevent the controls from turning gray, but it will disable them
I will try this when I can and go from there. Thanks!
Well, one thing you can do is to have a variable be set when you want them locked.
dim BoolCheck as boolean
dim BoolOption as boolean
Private sub Check1_click()
if BoolCheck = True then
Check1.value = vbChecked
end if
end sub
Private sub Option1_click()
if BoolOption = true then
Option1.value = True
end if
end sub
That way, whenever code gets execute that you want to lock the option and checkbox, you can put
BoolCheck = true
BoolOption = true
and when you want them to beable to change them, set them too false.
Hopefully I got what you are trying to do. Let me know.
Jacamar
dim BoolCheck as boolean
dim BoolOption as boolean
Private sub Check1_click()
if BoolCheck = True then
Check1.value = vbChecked
end if
end sub
Private sub Option1_click()
if BoolOption = true then
Option1.value = True
end if
end sub
That way, whenever code gets execute that you want to lock the option and checkbox, you can put
BoolCheck = true
BoolOption = true
and when you want them to beable to change them, set them too false.
Hopefully I got what you are trying to do. Let me know.
Jacamar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is the best answer yet, no offense to the others. I had already implemented this when I found your response. I am creating a new label dynamically and setting its container property to the container of the disabled control. This is perfect.
Thanks!!!
Thanks!!!
I think there is an easier solution:
in the delcarations area (the top of the module):
private mintQuestion as integer
in the form_load event:
mintQuestion = vbChecked (or False which ever you need)
chkQuestion = mintQuestion
in the click event:
chkQuestion = mintQuestion
now you have a variable that you can change programatically just remember that afterwords you have to put in another chkQuestion = mintQuestion if you always want the checkbox to reflect the value.
in the delcarations area (the top of the module):
private mintQuestion as integer
in the form_load event:
mintQuestion = vbChecked (or False which ever you need)
chkQuestion = mintQuestion
in the click event:
chkQuestion = mintQuestion
now you have a variable that you can change programatically just remember that afterwords you have to put in another chkQuestion = mintQuestion if you always want the checkbox to reflect the value.
and on the textbox
use the event keypress and make kesascii = 0 so no typing can be done any more?