[SOLVED] printing the content of wxTextCtrl Topic is solved

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
rocco.g
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Feb 25, 2006 9:48 pm
Location: Italy
Contact:

[SOLVED] printing the content of wxTextCtrl

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

Hi!

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!!!
Last edited by rocco.g on Sat Mar 25, 2006 10:29 am, edited 1 time in total.

rocco.g
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Feb 25, 2006 9:48 pm
Location: Italy
Contact:

Post by rocco.g » Mon Feb 27, 2006 3:37 pm

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: http://forums.wxwidgets.org/viewtopic.p ... t=printing

but it isn't solved...


can u help me... please?



(sorry for my english)

rocco.g
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Feb 25, 2006 9:48 pm
Location: Italy
Contact:

Post by rocco.g » Wed Mar 22, 2006 8:48 pm

so... is it not possibile to print the content of a wxtextctrl with wxwidgets?


:roll:

NinjaNL
Moderator
Moderator
Posts: 899
Joined: Sun Oct 03, 2004 10:33 am
Location: Oosterwolde, Netherlands

Post by NinjaNL » Thu Mar 23, 2006 8:23 am

Sorry Rocco, I meant to dig out some code for you.

I'll get around to it today.
Follow the development of my screenplay authoring program at http://wxscreenplaywriter.blogspot.com/

rocco.g
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Feb 25, 2006 9:48 pm
Location: Italy
Contact:

Post by rocco.g » Thu Mar 23, 2006 11:48 am

no no, don't worry Ninja!


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

gururamnath
Moderator
Moderator
Posts: 466
Joined: Sat Sep 18, 2004 2:49 am
Location: California, USA

Post by gururamnath » Sat Mar 25, 2006 12:30 am

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);
	easyPrint.PreviewText(strHTML);
-Guru Kathiresan

rocco.g
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Feb 25, 2006 9:48 pm
Location: Italy
Contact:

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

thankss!!!

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


thanks a lot, gururamnath!

gururamnath
Moderator
Moderator
Posts: 466
Joined: Sat Sep 18, 2004 2:49 am
Location: California, USA

Post by gururamnath » Sat Mar 25, 2006 2:20 am

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

rocco.g
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Feb 25, 2006 9:48 pm
Location: Italy
Contact:

Post by rocco.g » Sat Mar 25, 2006 10:29 am

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...

gururamnath
Moderator
Moderator
Posts: 466
Joined: Sat Sep 18, 2004 2:49 am
Location: California, USA

Post by gururamnath » Sat Mar 25, 2006 5:57 pm

Hi,
You dont need to be sorry. Just thought of letting you know about it.

-Guru Kathiresan.

Post Reply