Page 1 of 1

[SOLVED] printing the content of wxTextCtrl

Posted: Sun Feb 26, 2006 5:07 pm
by rocco.g

I have a window with several text controls and i would like to print all the fields which they contains, but i don't want to print the entire window, only the text in the form...

which function i have to use to do this?
is there any sample to see?

thanks to all!!!

Posted: Mon Feb 27, 2006 3:37 pm
by rocco.g
i saw the sample code in wxdevcpp but i need only to print what is write in wxTextCtrl and not the entire page...

i did a search in the forum and i have found nothing, only this topic: ... t=printing

but it isn't solved...

can u help me... please?

(sorry for my english)

Posted: Wed Mar 22, 2006 8:48 pm
by rocco.g
so... is it not possibile to print the content of a wxtextctrl with wxwidgets?


Posted: Thu Mar 23, 2006 8:23 am
by NinjaNL
Sorry Rocco, I meant to dig out some code for you.

I'll get around to it today.

Posted: Thu Mar 23, 2006 11:48 am
by rocco.g
no no, don't worry Ninja!

i need help about this problem, but i don't need it very very soon...

Posted: Sat Mar 25, 2006 12:30 am
by gururamnath
You can use HTMLEasyPrinting.

In the below example, try populating the strA and strQ varaibles with text control values.

Code: Select all

	wxString strHTML = "<html> \n";
	wxString strQ = "What is your Name ?";
	wxString strA = "My Name is wxHtmlEasyPrinting !";
	strQ = StrReplace(strQ,"\r","<br>");
	strA = StrReplace(strA,"\r","<br>");
	strQ = StrReplace(strQ,"\n","<br>");
	strA = StrReplace(strA,"\n","<br>");
	strHTML = strHTML + " <p> \n";
	strHTML = strHTML + " <b> " +  strQ + " </b> <br> <br>\n";
	strHTML = strHTML +  strA + "\n"; 
	strHTML = strHTML + "</p>";
	strHTML = strHTML + " \n</html>";

	wxHtmlEasyPrinting easyPrint("Question to HTML Easy Printing",this);
	easyPrint.SetHeader(wxString("HTML Easy Printing -") + wxT("(@[email protected]/@[email protected])<hr>"), wxPAGE_ALL);
-Guru Kathiresan

Posted: Sat Mar 25, 2006 12:52 am
by rocco.g

it works very great! it needs only to do some simply modifies to work with wxTextctrl!

thanks a lot, gururamnath!

Posted: Sat Mar 25, 2006 2:20 am
by gururamnath
A small note : After you find a post answered your question, you need to mark that post as acceptable one not the one you have replied to say thanks. The reason I'm telling you this is, people will be confused to see a post that doesnt give any solution for a problem and marked as acceptable answer.

-Guru Kathiresan

Posted: Sat Mar 25, 2006 10:29 am
by rocco.g
ah, i'm sorry!

but i saw the label "accetable" only for the last post and not for the first...

next time i'll do more attention!

i'm sorry! :(

EDIT: i modified the title of the topic by adding "SOLVED", i hope this will help users to understand that this topic has been solved...

Posted: Sat Mar 25, 2006 5:57 pm
by gururamnath
You dont need to be sorry. Just thought of letting you know about it.

-Guru Kathiresan.