?
Solved

Is it possible to lock (not disable) checkbox, option button, and mask edit controls?

Posted on 2003-03-05
8
Medium Priority
?
1,288 Views
Last Modified: 2013-12-25
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
Comment
Question by:vanoverp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 8074635
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
 

Author Comment

by:vanoverp
ID: 8074691
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 8074754
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.

 

Author Comment

by:vanoverp
ID: 8074781
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
 
LVL 2

Expert Comment

by:Jacamar
ID: 8075610
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
 

Accepted Solution

by:
applayer earned 200 total points
ID: 8075660
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
 

Author Comment

by:vanoverp
ID: 8075852
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
 
LVL 1

Expert Comment

by:StepCart
ID: 24171292
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question