|
-
Jul 9th, 2001, 06:55 AM
#1
Thread Starter
Addicted Member
Disable control(s)
Hello!
Another question by me...
How can I disable control (set Enabled=False) without graying it at runtime?
Sample: I need to disable control (checkbox, option button, text box and combo box). BUt not in the way of VB - it grays them. I need to disable them - they have to look as they weren't disabled. Is this achieveable?
Zvonko Bostjancic
Ilirska Bistrica, Slovenia
[email protected]
Using VS6 Professional with SP3
Programming mostly in VB and I've started to learn VC++ & MFC
-
Jul 9th, 2001, 06:57 AM
#2
Frenzied Member
Put a frame on the form, set it's borderstyle to none. Place the contol in the frame and disable/enable the frame rather than the control.
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Jul 9th, 2001, 07:03 AM
#3
Thread Starter
Addicted Member
Interesting...
However if I have 20, 30 or more controls added at runtime, it becomes very compicated 'cause each control must have its own frame...
Any other solution/suggestion?
Zvonko Bostjancic
Ilirska Bistrica, Slovenia
[email protected]
Using VS6 Professional with SP3
Programming mostly in VB and I've started to learn VC++ & MFC
-
Jul 9th, 2001, 09:03 AM
#4
Frenzied Member
Live with it!
It's a Windows GUI standard anyway, so users are used to seeing things greyed out when they are disabled.
Unless anyone knows any better...?
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Jul 9th, 2001, 09:16 AM
#5
Addicted Member
well...
with a textbox and a combo-box you can set the locked property to true, this also blocks input.
"Computers are incredibly fast, accurate and stupid. Human beings are incredibly slow, inaccurate and brilliant. Together they are powerful beyond imagination." - Albert Einstein
-
Jul 9th, 2001, 09:39 AM
#6
However if I have 20, 30 or more controls added at runtime, it becomes very compicated 'cause each control must have its own frame...
When you generate your controls, set each controls container to
be the frame{ Of course, mahke sure They're in the frames
visble area.)
Then when you Enable / Disable the frame, All your controls are zapped in one shot.
Example:
I have an indexed label in a frame. When I generate a new one,
I acheive the container effect this way:
lblLine_Count = lblLine_Count + 1
Load lblLine(lblLine_Count)
Set lblLine(lblLine_Count).Container = lblLine(lblLine_Count - 1).Container
-Hope this helps
-Lou
-
Jul 9th, 2001, 09:57 AM
#7
Of course,
You're right about needing a frame for each control, if you want
individual control over each of them. But, this is easy, if you use
a frame array, and when you generate a new control, you also
have it generate a new frame, then set the controls container to
that new frame.
Or,
Another way, instead of Disableing things, Everytime you make a control, BitBlt it, and place the Image of it at the spot on the form wher its going to go. Then, when you want it disabled, make it invisible, instead. It will appear as if its still there, but its only a picture.
Or,
Instead of disabling, use the controls tag. Change it to 1 when "disabled", its default would be 0 when "enabled", and on all its events, check the tag first, to see if action is currently allowed.
-Lou
-
Jul 10th, 2001, 08:35 AM
#8
Thread Starter
Addicted Member
BitBlt-ing Controls
Is using BitBlt function for creating image of control the same as using it on pictures in PictureBox or do I have to use any other "special" functions or features?
I haven't done it with controls yet so please post here your tips about it...
And another thing - when I change background, text, font... of control - does it have to be visible for BitBlt-ing it into image?
Zvonko Bostjancic
Ilirska Bistrica, Slovenia
[email protected]
Using VS6 Professional with SP3
Programming mostly in VB and I've started to learn VC++ & MFC
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
|