Results 1 to 8 of 8

Thread: Disable control(s)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    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

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    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."

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    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

  4. #4
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    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."

  5. #5
    Addicted Member reznor's Avatar
    Join Date
    May 2001
    Location
    Netherlands
    Posts
    151

    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

  6. #6
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    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

  7. #7
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    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

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    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
  •  



Click Here to Expand Forum to Full Width