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
vanoverpAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mikal613Commented:
well first change the combo style to 2
and on the textbox
use the event keypress and make kesascii = 0 so no typing can be done any more?
0
vanoverpAuthor Commented:
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
0
Mikal613Commented:
how about Text1.Locked = True
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

vanoverpAuthor Commented:
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!
0
JacamarCommented:
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
0
applayerCommented:
when you are looping through the controls on the form, you can call a subroutine specific to the control if you need to.

you could try using disabled option buttons and checkboxes in combinations with regular labels to keep the text readable...

you can adjust the width of the option button and check box dynamically, and when you need to enable these items you can set the .visible property of the label next to them = false and fill in the caption of the option button and check box.

for the masked edit control, you could swich out a locked text box and an enabled masked-edit control.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vanoverpAuthor Commented:
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!!!
0
StepCartCommented:
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.


0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.