1. Dhruv Jain
  2. PowerBuilder
  3. Tuesday, 23 April 2024 11:48 AM UTC

Hi,

We have an application created in PowerBuilder, with some services implemented in DotNet.

We need to change the mouse cursor from normal to Hourglass. Therefore, we have implemented the following methods to change the cursor and are calling them from DotNet before/after the required action.

Function 1:
public subroutine f_changetowaitcursor ()

SetPointer( HourGlass! )

end subroutine

Function 2:
public subroutine f_changetonormalcursor ()

pointer oldpointer
oldpointer = SetPointer(HourGlass!)
SetPointer(oldpointer)

end subroutine

However, when changing the cursor to an hourglass, if we click any mouse button, it reverts back to normal. Could you please suggest a solution for this?

Thanks

Ronnie Po Accepted Answer Pending Moderation
  1. Tuesday, 23 April 2024 17:07 PM UTC
  2. PowerBuilder
  3. # 1

If you can tolerate some flickering of the cursor, the following should work:

 

// First declare a global variable

boolean gb_waiting

Function 1:

public subroutine f_changetowaitcursor ()

gb_waiting = TRUE

DO
  SetPointer(hourglass!)
  Yield()
LOOP WHILE gb_waiting

end subroutine

Function 2:
public subroutine f_changetonormalcursor ()

gb_waiting = FALSE

end subroutine

 

Comment
  1. Dhruv Jain
  2. Wednesday, 24 April 2024 04:33 AM UTC
Ronnie, I need to change the cursor style only during the implementation of the .NET code. This is because PowerBuilder is calling a different service, Service1, to execute, and Service1 is calling Service2 to execute further actions. I need to display a loading cursor while Service1 is calling Service2. I hope that clarifies my request.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 24 April 2024 12:14 PM UTC
Hi Dhruv;

This might be an alternative for you ...

FYI: https://chrispollach.blogspot.com/2024/04/marquee.html

Food for thought.

Regards ... Chris
  1. Helpful
  1. Ronnie Po
  2. Wednesday, 24 April 2024 16:29 PM UTC
If Chris' alternative doesn't work for you, another option would be to show a popup window in PB, rather than changing the cursor.
  1. Helpful
There are no comments made yet.
Dhruv Jain Accepted Answer Pending Moderation
  1. Tuesday, 23 April 2024 14:26 PM UTC
  2. PowerBuilder
  3. # 2

Is there any other way to change mouse cursor style while some process is going in dotnet?

Comment
  1. Dhruv Jain
  2. Tuesday, 23 April 2024 17:00 PM UTC
How to call SetPointer func directly from the dotnet code?
  1. Helpful
  1. Roland Smith
  2. Tuesday, 23 April 2024 20:15 PM UTC
I meant to call SetPointer directly in the PB script that calls the dotnet function. Don't call f_changetowaitcursor because it introduces an end of script condition..
  1. Helpful
  1. Dhruv Jain
  2. Tuesday, 23 April 2024 20:20 PM UTC
I am calling powerbuilder function from dotnet to chane cursor style.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 23 April 2024 14:07 PM UTC
  2. PowerBuilder
  3. # 3

The premise on which you've developed this code is faulty. This is not how the SetPointer() PowerScript function is designed to work.

From the PB Help topic "SetPointer (PowerScript function)":

Best regards, John

 

Comment
  1. Dhruv Jain
  2. Tuesday, 23 April 2024 17:01 PM UTC
Hi John, Can you suggest what code should i write to achieve this. Thanks.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.