1. Tom Peters
  2. PowerBuilder
  3. Monday, 9 November 2020 20:01 PM UTC

Good Day!

I am experimenting with ASync=1 / RetrieveRow scripted so that my users can cancel long-running retrieval. 

It works, beautifully, but I have not been able to get SetPointer( AppStarting! ) to hold its image. This means the user has no "normal" visual indicator that things are happening behind the scenes. I do have the cancel button enabled, so a super user would figure it out. But it would be nice if the pointer could hold its image until the process ends.

  1. ASync is set to 1
  2. SetPointer( AppStarting! )
  3. n_ds.Retrieve( ) - IMPORTANT: This is a stored procedure DataWindow.
    1. RetrieveRow has code in it to check for user cancellation.
  4. Retrieval either finishes or is cancelled by the user.

The issue is that the pointer goes right back to an Arrow as soon as the Retrieve starts.

My guess is that ASync is, understandably, interrupting the process that would have caused the pointer to stay put until the overall process ends.

Is there a way to force the pointer to stay as AppStarting! until the script ends or I programmatically switch it?

 

Thanks,

Tom

 

Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 10 November 2020 02:48 AM UTC
  2. PowerBuilder
  3. # 1

Hi Tom,

 

You can add the code below to the DataStore RetrieveRow event and see if it works:

SetPointer(HourGlass!)

 

Regards,

Ken

 

Comment
  1. Ken Guo @Appeon
  2. Wednesday, 11 November 2020 02:35 AM UTC
Hi Tom,



If you want SP to display AppStarting! Pointer and can be canceled at any time when gathering data, sorry that there is no better way to control it for now.

I suggest you not use the mouse arrow, instead, popup a small window with only one gif pic which shows Retrieve Data…

When retrievestart, this window popups. When retrieveend, close this window.





Regards,

Ken

  1. Helpful
  1. Ken Guo @Appeon
  2. Wednesday, 11 November 2020 02:35 AM UTC
Hi Tom,



If you want SP to display AppStarting! Pointer and can be canceled at any time when gathering data, sorry that there is no better way to control it for now.

I suggest you not use the mouse arrow, instead, popup a small window with only one gif pic which shows Retrieve Data…

When retrievestart, this window popups. When retrieveend, close this window.





Regards,

Ken

  1. Helpful
  1. Tom Peters
  2. Wednesday, 11 November 2020 14:47 PM UTC
Yeah, I'm going to have to use Shared Objects and have a different type of visual indicator. Thanks
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Monday, 9 November 2020 23:52 PM UTC
  2. PowerBuilder
  3. # 2


There is an API that will lock the pointer until you UNlock it. SImply call the function to LOCK the pointer, then call the one to UNLOCK it when you are done.

// From a tab page on a tab on a window:

// Lock the pointer into an HourGlass
iw_parent.FUNCTION of_set_hourglass (TRUE)

// UNLOCK the pointer into an HourGlass
iw_parent.FUNCTION of_set_hourglass (FALSE)




I put the following function into corp_w_master:

// Local External Functions (on the window)

// OKnight, 26-AUG-2008, R#283713.
FUNCTION ulong   SetCapture(ulong a) LIBRARY "user32.dll"
FUNCTION boolean ReleaseCapture()    LIBRARY "user32.dll"



//*********************************************************************
// Object     :  corp_w_master
// Function   :  of_set_hourglass()
//
// Ancestor   :  None
// Access     :  Public
// Arguments  :  None
//
// Returns    :  None
// Throws     :  None
//
// Description:  Force the cursor to stay in the HOURGLASS shape.
//
//********************************************************************
// Revision History
//
// Developer    Date         Version     Description
// ---------   -----------   ---------   -------------------------------
// O Knight    28-NOV-2017   6.0.4.33    #2026345:  Implement new copyright.
// O Knight    26-AUG-2008   6.0.0.21    R#283713:  Initial installation
//
//********************************************************************
// COPYRIGHT © 2017 CSG SYSTEMS INTERNATIONAL, INC. AND/OR ITS
// AFFILIATES (“CSG”). ALL RIGHTS RESERVED.
//********************************************************************
ulong ll_handle, ll_rc



if (ab_switch) THEN
    ll_handle = Handle(this)
    ll_rc = SetCapture(ll_handle)
    SetPointer(hourglass!)
ELSE
    
    ReleaseCapture()
    
END IF

Comment
  1. Tom Peters
  2. Tuesday, 10 November 2020 14:53 PM UTC
I will be trying this... thanks, and stay tuned.
  1. Helpful
There are no comments made yet.
Christopher Craft Accepted Answer Pending Moderation
  1. Monday, 9 November 2020 22:48 PM UTC
  2. PowerBuilder
  3. # 3

My guess is the issue is somewhere in the DW Stored Procedure feature. I had a similar issue with Print().

Couple things to try though:

1) If you don't have this already, try adding the following to your PB.INI file (make sure you modify the correct one).

[DataStore Behavior]
UseHwnd=0

2) Can you make this retrieve work in a Shared Object instead?  Sounds like you are wanting this behavior anyway.

 

Chris Craft

Comment
  1. Tom Peters
  2. Tuesday, 10 November 2020 14:52 PM UTC
Hi Chris -



Shared Objects has always been on the table. Using ASync does everything I need except the pointer staying in place. If other ideas do not work for me, I will ultimately end up using Shared Objects.



Thanks!

Tom
  1. Helpful
There are no comments made yet.
Tom Peters Accepted Answer Pending Moderation
  1. Monday, 9 November 2020 20:23 PM UTC
  2. PowerBuilder
  3. # 4

Hi Andrew -

The pointer goes back to an arrow as soon as the retrieve starts, before retrieverow is hit. 

I am updating the question with one nuance... 

Thanks

 

Comment
There are no comments made yet.
Andrew Barnes Accepted Answer Pending Moderation
  1. Monday, 9 November 2020 20:20 PM UTC
  2. PowerBuilder
  3. # 5

Do you lose your pointer when the Retrieve starts or when it hits the RetrieveRow event?  I have never done anything exactly to what you are doing, but in other similar situations, I have seen PB revert the pointer during a process forcing me to programmatically reapply it within intermediate events.

Comment
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.