This is from a client ... and I need to trap it.
Using the tPrinter class for a report:
1). Using PRINT oPrn NAME "Workorder Printing" FROM USER // Send to user selected printer
2).The printer selection dialog pops up.
3) Instead of selecting a printer, the user clicks the Cancel button
4). The program gets a Windows error that the program has stopped working.
How can I trap and respond to this cancel button ?
Please ... don't ask me why he does this. That is beyond me since he has many other options in the process where he can cancel, but he does it here ...
Printer class: selection errors
Printer class: selection errors
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Printer class: selection errors
The following sample doesn't error out here. Please change it to show the error.
EMG
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
DEFINE DIALOG oDlg
@ 1, 1 BUTTON "Print";
ACTION PRINT()
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
STATIC FUNCTION PRINT()
LOCAL oPrn
PRINT oPrn NAME "Test" FROM USER PREVIEW
PAGE
oPrn:Say( 0, 0, "Test" )
ENDPAGE
ENDPRINT
RETURN NIL
Re: Printer class: selection errors
Remove PREVIEW, then when the printer selection dialog appears, hit Cancel.Enrico Maria Giordano wrote:The following sample doesn't error out here. Please change it to show the error.
EMG
If Cancel is selected, then oPrn is not created ( I assume ), so it's possible other actions involving oPrn would then fail. How can I trap for that Cancel ?
Sent from my iPhone using Tapatalk
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Printer class: selection errors
I removed PREVIEW clause: still no errors clicking Cancel button.
EMG
EMG
Re: Printer class: selection errors
OK ... It's just on one very complex invoice print routine.
I suppose it's time to go back and do a section by section "comment out" test to find where it creates the error ... and see if some of my code perhaps conflicts with the class.
Thanks for looking at that.
Of course I have no idea why the client is doing this ...
Tim
I suppose it's time to go back and do a section by section "comment out" test to find where it creates the error ... and see if some of my code perhaps conflicts with the class.
Thanks for looking at that.
Of course I have no idea why the client is doing 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
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Re: Printer class: selection errors
I always use this and it works:
PRINT oprn name pname from user
IF EMPTY( oprn:hdc )
RETURN nil
ENDIF
PRINT oprn name pname from user
IF EMPTY( oprn:hdc )
RETURN nil
ENDIF
Re: Printer class: selection errors
Thanks ... works perfectly in this case.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019