CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    MousePointer vbHourglass and Enabled = False

    I'm calling an asynchronous COM method from a VB6 application. When waiting for
    the callback I want the mousepointer to be vbHourglass and input to be disabled.

    My problem is that when calling Enabled = false on the main form the mousepointer is changed back to the default one.


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: MousePointer vbHourglass and Enabled = False

    When setting a form disabled, you also set all it's properties disabled, like the mousepointer. Another thing you can do is set the elements that can receive input disabled, the code is a bit longer, but your mousepointer remains the hourglass. Your code should look a bit like this.

    private sub setEnabled(byval value as boolean)

    if value then
    form1.mousepointer = vbHourGlass
    else
    form1.mousepointer = vbNormal
    end if

    myTextField1.enabled = value
    myTextField2.enabled = value
    myTextField3.enabled = value
    myButton1.enabled = value
    myButton2.enabled = value
    myButton3.enabled = value
    .
    .
    .

    end sub



    So when you call the sub, just specify if the controls should be enabled(true) or disabled(false).

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: MousePointer vbHourglass and Enabled = False

    or ...

    if you are sure that you really want to disable *all* the controls on the form :


    Dim oCtl as Control
    '
    on error resume next ' Just incase a control doesn't have '.enabled'
    '
    for Each oCtl in me.Controls ' or form1.controls etc
    oCtl.Enabled = false ' or true, or whatever your var is
    next







    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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

Featured