Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1300
  • Last Modified:

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
0
vanoverp
Asked:
vanoverp
1 Solution
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now