April 26, 2024, 11:18:43 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Problem with Addaccelerator keys and Printing contents of edit boxes to printer

Started by AdrianFox, December 04, 2008, 03:29:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AdrianFox

1. Having a slight problem with Addaccelerator keys. 

No matter what they are set for (ie ALT or CTRL), and even if only one is set rather than all the menu items, when I type in my edit box each character appears four times  'tttt jjjj' etc.

This is the first time I've had this problem and without the accelerator keys the program works fine.

Without posting all the code, I am using 19 different edit boxes and 19 checkboxes, but apart from that it is a fairly simple  program making Todo lists.

Any ideas?

2. The other major problem is that using the following code the printer (an HP Deskjet) hangs and I can't even print to a pdf file on my desktop, though this works ok on the laptop where I've written the program in the first place:

startpg = 1     
endpg = 1
copies = 1
collate = 1
printer = PRTDIALOG(d1,startpg,endpg,copies,collate)
hprinter = OPENPRINTER(printer,"Document","text")
if(hprinter)

      'loop to enter contents of the 19 edit boxes
for x=1 to 19

texttoprint=texttoprint+chr$(13)+str$(x)+" "+getcontroltext(d1,x)
next x
texttoprint=listopen+chr$(13)+DATE$("ddd',' MMM dd yy")+chr$(13)+texttoprint
buffer=texttoprint
WRITEPRINTER hprinter, buffer
CLOSEPRINTER hprinter
       ' reinitialise the buffer and the other variables if necessary
buffer="":texttoprint="":filename$=""
endif


Can anyone point me towards any information on overcoming printer problems?

Thanks

Adrian


Adrian Fox

Ionic Wind Support Team

Adrian,
#1.  Have no idea, as I've never encountered anything like that before.  Almost sounds like there is a key logger running.

#2. That's an easy one, most "windows only" printers don't have the ability to print straight text using WRITEPRINTER.  Because they don't have any hardware fonts and depend on the Windows GDI for output.  Even some cheaper laser printers suffer from this now.  The only Emergence provided solution is to use PRINTWINDOW and a hidden window that you have created for output.

Paul.
Ionic Wind Support Team

AdrianFox

Paul

Thanks  for the information about the printer problem.  I must be learning something as I had solved my problem in exactly the way you suggest by the time I saw your reply to my post, though I printed the text to the main window (where it was hidden on screen behind the edit boxes!) but would print out when I called 'printwindow'.

It only prints in a very small system font though, nothing like the screen font I'm using.   I have been looking through the documentation to find out if I can print out in the screen font.  Is this easily achieved, or is it something for future development?

On the Addaccelerator thing, I will keep experimenting to see if changing anything else in the program prevents it from happening, just out of curiosity.

Thanks for your advice.

Adrian
Adrian Fox

Ionic Wind Support Team

Use SETFONT to change the windows font.

The output should look the same in the window and on the printed page, it scales in the X direction to fit the page so if your aspect ratio is weird then it may make the fonts look smaller.

What I usually do is create a hidden, captionless window, sized 612x792 or a multiple of same, and format output to that.  The dimensions match the ratio of an 8.5 x 11 inch page.  Then using PRINTWINDOW you get a wysiwyg output.

Paul.
Ionic Wind Support Team