Focus issue with printing

Post Reply
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Focus issue with printing

Post by TimStone »

I use the tPrinter class for all reports and printouts.

Here is the setup. The program has a button to call a function which creates a printed invoice. The ACTION statement of the button calls the invoice printing function. The user then gets to choose the printer ( default or select a printer ) and if it is directly printed, or previewed. Once the selection is made, the invoice is printed ( or previewed ), and then the main invoice screen reappears.

In a few locations the clients are seeing the following behavior suddenly. The printer selection window appears, and if they select an alternate printer, which calls the windows printer selection screen, or sometimes when they select the preview, there are some flashes and the print screen(s) lose focus, and the main invoice dialog returns. There are no icons for the print dialogs on the task bar.

Has anyone seen this type of behavior and developed a process by which the function called by a button must complete before the calling dialog can regain focus ?

The call is simple: REDEFINE BUTTON oBtn ACTION PrintInvoice()

Your thoughts and ideas are appreciated !

BTW, this is a new behavior but not related to a newer version of FWH. The computers are older ( 333 MHz, 256 MB RAM, dot matrix printers, shared ).

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Tim,

You can disable the calling dialog with oDlg:Disable() and then enable it again with oDlg:Enable() once the process finishes
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Focus

Post by TimStone »

I have managed to get some of this under control. Using the command:

DEFINE BUTTON abc OF oDlg ACTION ( PrintInvoice( ), oDlg:setfocus( ) )

will bring the dialog back into focus instead of having the focus go elsewhere to another active dialog. HOWEVER, if I do a preview ( rpreview ), I find that the preview activates another window ( correct behavior ), but once that window is painted, rpreview passes control back to the calling program which then sets the calling dialog in focus, leaving the print window open in the background.

You use a stop in rpreview, but the VALID clause automatically sets the value to .t. so the stop doesn't work. The desired behavior is to not return to the calling dialog until the preview window is closed.

Thoughts on this ?

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Tim,

You can set the preview to behave MODAL:

PRINT oPrn PREVIEW MODAL
...
ENDPRINT
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

MODAL`

Post by TimStone »

I've got two copies of this program I'm working on. The new one is with the current FWH and xHarbour, and the other, which I use for release purposes, is with the January releases.

The current one I set to MODAL ... forgot to do it on the older one which is the one I test/distribute.

I'll give that a try.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Post Reply