Disable container and change mouse pointer

Is it possible to disable a container control on a window and change the mouse pointer for the container control. I have tried creating a method in the container control with the following code but it gives me the error “Static reference to instance method: call this on an instance of class cntHome.cntHome.”

Self.Enabled = True Self.MouseCursor = System.Cursors.StandardPointer

I have also tried to set it on the window by referencing the container but that didnt work either.

Works fine here. Check this example app:
Container Enabler

[quote=439755:@Tim Jones]Works fine here. Check this example app:
Container Enabler[/quote]

Hi Tim, yes that works but it doesnt work if you call it from the window itself for example I have a window which has a container called MyCont and in the window I have a button that has the following code:

dim waitWindow as new winWaitWindow

MyCont.Enabled = False
MyCont.MouseCursor = system.Cursors.Wait
waitWindow.show
.....
MyCont.MouseCursor = system.Cursors.StandardPointer
MyCont.Enabled = True

Can you share a sample?

I don’t know if you the problem is when you try to run, the cursor not changing or the container not getting disabled.

Still no issue - here it is updated with the Enable/disable in a button on the Main window that the container is embedded within:

Container Enabler Updated

I use this type of logic all of the time, so I know it works.

[quote=439765:@Tim Jones]Still no issue - here it is updated with the Enable/disable in a button on the Main window that the container is embedded within:

Container Enabler Updated

I use this type of logic all of the time, so I know it works.[/quote]
Tim, when I click the Disable/Enable button the cursor did not change. This on macOS 10.12.6. Does it change for you?

[quote=439761:@Nathan Wright][code]
dim waitWindow as new winWaitWindow

MyCont.Enabled = False
MyCont.MouseCursor = system.Cursors.Wait
waitWindow.show

MyCont.MouseCursor = system.Cursors.StandardPointer
MyCont.Enabled = True
[/code][/quote]
Are you expecting that to work like a loading screen? This won’t have any effect, as the whole method will execute before any updates are sent to the interface. The enabled=false and enabled=true will happen at the same time for the user.

You need to design your code to be event-driven. When whatever this long process is completes, it should raise an event or notify something that it’s done. How that’s implemented depends on what your long process is, and how you implemented that.

You need to move your mouse over the container. I only change it there, not for the whole app since that’s what Nathan asked for:

[s]Thanks everyone, that all helps me and now understand what I need to do. Just for interest I am still a little confused why the following example gives an error, just for curiosity sake.

Test Project[/s]

Sorry ignore my last post, just realised I was referring the wrong object, should have reference MyCont1 and not MyCont!!!

Sorry for the off-topic posts.

I see now that if I click Disable/Enable and move the mouse over the container, it changes the pointer. Why when I click the button in the container and move the mouse outside of it, it doesn’t change? Sorry if this is in some docs, I can’t find why it behaves like that.

I didn’t write that wait loop with UI updating in mind, so it’s not refreshing. Change the App.DoEvents to this:

Dim x As Integer For x = 0 to 399 App.DoEvents(10) Next

Now, the mouse cursor will change when you leave the Container surrounds while the artificial delay is running.