Click to See Complete Forum and Search --> : MousePointer vbHourglass and Enabled = False


February 14th, 2000, 06:08 AM
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.

Cakkie
February 14th, 2000, 01:12 PM
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
slisse@planetinternet.be

The best way to escape a problem, is to solve it.

Chris Eastwood
February 14th, 2000, 02:20 PM
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