This article was brought to you by the guys from VDF-GUIdance.
For more DataFlex targeted articles see http://www.vdf-guidance.com


Prevent Status Panels losing the focus

by Geoff Furlong

Summary

The status panel used in BPOs and Winprint will lose its focus when switching to other applications and back. The result is that the application appears to have locked up while it is in fact still running the report or business code. This describes a fix for the problem.
No Files Available
Date Created: 03/10/1999
Date Updated: 20/10/1999
Author: Geoff Furlong
Company: MSG Business Systems Ltd.


Prevent Status Panels losing the focus


Ever wondered how to make VDF panels "stay on top"?
Try the following code in your panel/dialog/etc Activating procedures
// To make the status_panel stay-on-top, we first find it's window handle ...
Move (FindWindow("DFDialogClass", Caption_Text(Self))) To hWnd#

// ... then we add the extended style WS_EX_TOPMOST to the window, but we use SetWindowPos
// to make sure the change takes effect immediately.

Move (SetWindowPos(hWnd#, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE ior SWP_NOSIZE)) To swp#

I've used this to make the BPO status panel stay where it should and not disappear if the VDF app loses the focus.

With a little change to the above the status panel will also support special characters. This way it will also work in programs that are written for non-english languages.

replace the line
   Move (FindWindow("DFDialogClass", Caption_Text(Self))) To hWnd#


with
   Move (FindWindow("DFDialogClass",ToAnsi(Caption_Text(Self)))) to hWnd#