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.”
[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
[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:
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.
[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.
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.