Window Freezing

Discussion forum about all things Team Developer 7.x
FRBhote
India
Posts: 127
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Window Freezing

Post by FRBhote » 20 Oct 2017, 12:49

In a window which displays the status bar, when I see any other window and come back, the status bar does not show progress and the window freezes.

Is that normal?
freeze.png
You do not have the required permissions to view the files attached to this post.

memic
Germany
Posts: 21
Joined: 07 Mar 2017, 08:51
Location: Germany

Window Freezing

Post by memic » 20 Oct 2017, 13:44

Try to call SalYieldStartMessages( status bar handle ) after SalStatusSetText()

FRBhote
India
Posts: 127
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Window Freezing

Post by FRBhote » 23 Oct 2017, 05:05

Can't figure out how to get the handle of the status bar. SalGetFirstChild doesn't have that TYPE_*.

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 66
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Window Freezing

Post by thomas.uttendorfer » 23 Oct 2017, 08:10

Hi,
call SalYieldStartMessages( hWndFrame ).

Code: Select all

On SAM_Click
	Call SalMessageBox( 'Click', 'Info', MB_Ok )
	Call SalYieldStartMessages( hWndForm )
	While 1
		Set nCount = 0
		While nCount < 10000
			Set nCount = nCount + 1
		Set nDisplay = nDisplay + 1
		Call SalStatusSetText( hWndForm, SalNumberToStrX( nDisplay, 0 ) )
But be careful: The user can use the whole form-window. E.g he or she can click the button again or even Close the window - which will then be invisible but will run in the Background (have a look with Windows task Manager).
Regards Thomas
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

FRBhote
India
Posts: 127
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Window Freezing

Post by FRBhote » 23 Oct 2017, 11:53

Does the job very well.

But since the user can change datafields it wouldn't work.

Thanks!

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 691
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Window Freezing

Post by Dave Rabelink » 23 Oct 2017, 13:31

This "freezing" is normal.

It is a Windows feature that when an application GUI thread does not respond within 5 seconds, Windows will "ghost" the window and freeze the contents.
The title bar will also show "not responding".

This feature enables the user to move the frozen window, but the contents are not updated.

Read this article for more info :
https://blogs.technet.microsoft.com/ask ... r-windows/

To disable this feature, use the WinApi function from user32.dll : DisableProcessWindowsGhosting.
But be aware that when disabled, the window can not be used (moved, closed) until the GUI has finished the long action.

The issue with TD applications is that they do not have a separate GUI thread.
So when your application performs a lengthy operation (database update, calculations etc) which takes longer than 5 seconds, your application will be ghosted by Windows.
It would be nice Gupta finds a way to prevent this ghosting out-of-the-box.
(Maybe using the TD 7.1 multi-threading feature?)

You can download a sample to show how to call DisableProcessWindowsGhosting from here:

http://samples.tdcommunity.net/index.ph ... Sample.zip

How to use:
- Run sample as executable
- Press button to start lengthy operation for 30 seconds. During execution the datafield is updated with the current time
- Switch to another application and wait 5 seconds as minimum
- Go back to the sample and see that the window is frozen
- When 30 seconds are over, the form is unfreezed and can be used again

Now repeat this but first check the option to disable ghosting.
See that now, the datafield is updated during the 30 seconds and no "not responding" text is displayed in the title bar.

This sample also shows the "Yielding" solution by using a hidden form which is yielded.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

FRBhote
India
Posts: 127
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Window Freezing

Post by FRBhote » 24 Oct 2017, 05:30

Good. Let me try it out.

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests