1. David Peace (Powersoft)
  2. PowerBuilder
  3. Monday, 17 July 2023 15:33 PM UTC

Hi Guys

Another oddity when themes have been applied. We have an MDI application with multiple windows open, when we do a DW retrieve on a long query from the DB, PB showns not responding (expected behaviour). But also blanks the windows within the MDI screen leaving the user looking at a blank MDI frame with no menu etc rendered. Theer is some data in a statictext that is on the MDI frame still visible.

Windows 10, PB2022 Build 1900 - SQLAnywhere DB.

Accepted Answer
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Tuesday, 18 July 2023 06:21 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi David,

I've come across this problem, too. Usually Windows will create a "ghost" window for unresponsive applications that is basically a screenshot of the last known state of the app and hides the actual window. This is done to let the user at least interact and minimize, move etc. the unresponsive application.

PB's Themes feature messes with this somehow. One workaround is to use the DisableProcessWindowsGhosting api function to disable this feature completely for your app, with the obvious drawback that an unresponsive window will simply be unresponsive without any indication or interactivity.

Of course you could do long DB operations on a background thread to avoid an unresponsive UI thread altogether but that will obviously require some work.

 

John Fauss has written an exhaustive article on this, too.

 

Comment
  1. Benjamin Gaesslein
  2. Tuesday, 18 July 2023 08:35 AM UTC
That would be nice, indeed. It doesn't help that multithreading in PB is both complicated to implement and nigh impossible to debug.
  1. Helpful
  1. David Peace (Powersoft)
  2. Tuesday, 18 July 2023 08:36 AM UTC
The article is very useful, the problem is that control has been passed to the Database, PB is genuinely not responding. Without Themes the user is happy to look at the screen waiting for the data to appear. With themes because the screen goes blank they then think that it has hung and start faffing about to remedy the situation or report it as a fault.
  1. Helpful
  1. Benjamin Gaesslein
  2. Tuesday, 18 July 2023 08:43 AM UTC
Yes, the only way to keep the UI responsive during a long database operation is to use multithreading via shared objects. This is what I'm doing in my project, I have a thread handler object in the application manager that keeps a handful of persistent database connections. When I have db queries that I know might take a while I can then request a db thread to do the retrieve to keep the UI responsive.



John has written a follow-up article on multithreading here if you're interested:



https://community.appeon.com/index.php?option=com_content&view=article&id=339&do=1
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 17 July 2023 17:45 PM UTC
  2. PowerBuilder
  3. # 1

Sounds like a bug to me David.

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.