Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » How to add some text to RichTextview?
How to add some text to RichTextview? [message #1422] Fri, 03 March 2006 14:57 Go to next message
Cpu86 is currently offline  Cpu86
Messages: 3
Registered: March 2006
Junior Member
Hi,
I have a richtextview and I want to add some text at the end of the text is already present.
I do this:

String s = elenco.GetData();
char *str_elenco = (char *)malloc(sizeof(char) * (strlen(~s)+8));
strcpy(str_elenco,~s);
strcat(str_elenco,"[+10 A]");
elenco.SetData(str_elenco);

But doesn't work.
Anyone can help me?

Thanks
Marco

[Topic name edited by fudadmin and moved from "library wishlist"]

[Updated on: Fri, 03 March 2006 21:34] by Moderator

Report message to a moderator

Re: RichTextview [message #1423 is a reply to message #1422] Fri, 03 March 2006 15:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Cpu86 wrote on Fri, 03 March 2006 08:57

Hi,
I have a richtextview and I want to add some text at the end of the text is already present.
I do this:

String s = elenco.GetData();
char *str_elenco = (char *)malloc(sizeof(char) * (strlen(~s)+8));
strcpy(str_elenco,~s);
strcat(str_elenco,"[+10 A]");
elenco.SetData(str_elenco);

But doesn't work.
Anyone can help me?

Thanks
Marco


My guess is that you have got into "Zoom troubles" (and perhaps used RichTextCtrl instead of RichTextView).

This seems to work:

#include <CtrlLib/CtrlLib.h>

#define LAYOUTFILE <RichView/RichView.lay>
#include <CtrlCore/lay.h>

class RichView : public WithRichViewLayout<TopWindow> {
public:
	void Add();

	typedef RichView CLASSNAME;
	RichView();
};

void RichView::Add()
{
	text <<= String(~text) + "test&";
}

RichView::RichView()
{
	CtrlLayout(*this, "Window title");
	add <<= THISBACK(Add);
	text.SetZoom(Zoom(140, 1000));
	Sizeable();
}

GUI_APP_MAIN
{
	RichView().Run();
}

LAYOUT(RichViewLayout, 200, 392)
	ITEM(RichTextView, text, HSizePosZ(4, 4).VSizePosZ(4, 40))
	ITEM(Button, add, SetLabel(t_("Add")).LeftPosZ(4, 42).TopPosZ(356, 32))
END_LAYOUT


Mirek
Re: RichTextview [message #1424 is a reply to message #1423] Fri, 03 March 2006 16:15 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Cpu86, please learn to post smart topic names...
Previous Topic: RTF Table problem [BUG][FIXED?]
Next Topic: RichTextView: Size is wrong without scrollbar
Goto Forum:
  


Current Time: Fri Mar 29 14:54:26 CET 2024

Total time taken to generate the page: 0.01605 seconds