Changing the mouse cursor image

I know I can change the mouse cursor image based on it rolling over an object.

Can I get it to change regardless of the position based upon a dynamic property being set or reset?

Here is why. I have 18 identical air cooling units. I have a screen for the air cooling units that I populate with data based upon a table that is indexed off a field I call EA.

On the air unit window I created a dynamic property called air_unit.

A typical query:

SELECT Room_Temp FROM ammonia_air_unit WHERE EA = {Root Container.Air_Unit}

I can call the window from the main screen air unit icons and pass the air unit number to the window or scroll through the units once it is open. The air_unit property will increment/decrement as I scroll through each unit.

The problem is there can be a delay sometimes of several seconds while the queries run and the data gets updated. It isn’t too bad locally but from where I am, going through several layers to get to the project, it can take a little time.

Nathan has seen this in operation.

I wanted to give some sort of indication that the screen was in the process of updating so somebody that might be having the same delay would realize to wait before getting click happy.

My idea was to compare the air_unit dynamic property with the appropriate row in the EA field in the database table.

With Nathan’s help in refining this I created a dynamic property in the root container of the window called update_variable that is bound to the EA field in the database table:

SELECT EA FROM ammonia_air_unit WHERE EA = {Root Container.Air_Unit}

I also created a dynamic property called loading. It’s value is determined by the expression:

{Root Container.Air_Unit}!={Root Container.Update_Variable}

The air_unit property updates immediately and the update_variable is updated subject to the delay described above. So while they are not equal
the loading property is equal to 1.

So with that I can now give an indication that the screen is in the process of updating. There are lots of ways to do that and one I would like to do is change the mouse cursor to an hourglass.

Kind of long winded but I wanted to explain the how and why I got to this point.

Thanks in advance.

Very clever setup. Before I go into a response, I just want anyone else reading this thread that simple query delays in the 1 second plus range are atypical for FactoryPMI, so situations like the one describe here are not normal. You must be going through some strange/slow network layers, yes? Even so, I have lots of experience using FactoryPMI through a VPN, and the delays are imperceptible. I’d be curious to know what kind of networking you’re going through.

Ok, the anwser here is really quite simple. You use the propertyChange event. Just like you can write a script to handle the mouse going over a component, you can write a script to handle the event that a property has changed on that component. So, you can put a script like the following on the component that has your loading property defined (probably the root container)

if event.propertyName == 'loading': from java.awt import Cursor isLoading = event.newValue if isLoading: hourglass = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) event.source.cursor = hourglass else: normal = Cursor.getDefaultCursor() event.source.cursor = normal

Yes, I know the cursor manipulation involves strange scripting calls into Java - this will be made easier sometime soon.

Let me know if you have any questions,

The answer to the networking issue is yes. I think. It is possibly a combination of my home network setup and their network setup. On site it has a much quicker response time. But for those who will connect to this remotely, I wanted to give some kind of feedback that the data is loading in case they see any delay as well.

Another thing I did last night was use the “loading” property to disable anything on the screen that a person can interact with until the “loading” property goes to zero.

Yeah, thats a good idea too, safer than just using the cursor.