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 » U++ Widgets - General questions or Mixed problems » How To Find/Replace on RichEditWithToolBar
How To Find/Replace on RichEditWithToolBar [message #16539] Mon, 23 June 2008 22:14 Go to next message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
Hi all,
I am trying to use a button to test the find/replace operation on the RichEditWithToolBar but I cant access that member.
Can you, please, tell me How do I do that?
A sample source code would be appreciated,

Thank you,

Alex
Re: How To Find/Replace on RichEditWithToolBar [message #16548 is a reply to message #16539] Tue, 24 June 2008 17:48 Go to previous messageGo to next message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
Is it possible to make this?

Thank you
Alex
Re: How To Find/Replace on RichEditWithToolBar [message #16560 is a reply to message #16548] Thu, 26 June 2008 10:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
alex100 wrote on Tue, 24 June 2008 11:48

Is it possible to make this?

Thank you
Alex



You cannot invoke it directly, but there is

void FindReplaceTool(Bar& bar, dword key = K_CTRL_F);

member that adds the button to any toolbar.

Note that button just opens the find dialog, IMO it is pointless to expose this as public (but I can if you think it would help, OTOH it would lock us with currect find/replace user interface).

Mirek

[Updated on: Thu, 26 June 2008 10:44]

Report message to a moderator

Re: How To Find/Replace on RichEditWithToolBar [message #16575 is a reply to message #16560] Sat, 28 June 2008 09:12 Go to previous messageGo to next message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
Yes, I would like to open a document with some custom tags in there and then replace that tags with some text but in automated fashion...

Is there any ideas?

Nuno Costa
PS: I think this is a very important feature for the RichEdit widget...
Re: How To Find/Replace on RichEditWithToolBar [message #16580 is a reply to message #16575] Sat, 28 June 2008 22:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
alex100 wrote on Sat, 28 June 2008 03:12

Yes, I would like to open a document with some custom tags in there and then replace that tags with some text but in automated fashion...

Is there any ideas?

Nuno Costa
PS: I think this is a very important feature for the RichEdit widget...


What do you mean by "custom tags in document"?

Mirek
Re: How To Find/Replace on RichEditWithToolBar [message #16588 is a reply to message #16580] Mon, 30 June 2008 11:34 Go to previous messageGo to next message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
Hi,

Suppose I have a database with some customers and I want to send a letter to all of them, for instance.

I was planning to write some document using the word processor (sample) that comes with Ultimate++. Suppose this document:


Customer name: <NNNNNN>
Customer id: <iiiiiii>
Customer adsress: <D1D1D1D1>
<D2D2D2D2>
<D2D2D2D2>
<D3D3D3D3>

Dear <NNNNNN>

Congratulation for blablablabla
blablablavla
...


Then when I choose "send letter to customers main menu"

I would like to open a dialog with a RichEdit widget that automatically opens the document above and also the database. Then for each customer it finds its details and replaces the tags
<
<NNNNNN>
<iiiiiii>
<D1D1D1D1>
<D2D2D2D2>
<D2D2D2D2>
<D3D3D3D3>

accordingly and prints a letter for each customer.


It that what I am trying to do.
Any ideas?

Many thanks

Alex
Re: How To Find/Replace on RichEditWithToolBar [message #16591 is a reply to message #16588] Mon, 30 June 2008 18:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
alex100 wrote on Mon, 30 June 2008 05:34

Hi,

Suppose I have a database with some customers and I want to send a letter to all of them, for instance.

I was planning to write some document using the word processor (sample) that comes with Ultimate++. Suppose this document:


Customer name: <NNNNNN>
Customer id: <iiiiiii>
Customer adsress: <D1D1D1D1>
<D2D2D2D2>
<D2D2D2D2>
<D3D3D3D3>

Dear <NNNNNN>

Congratulation for blablablabla
blablablavla
...


Then when I choose "send letter to customers main menu"

I would like to open a dialog with a RichEdit widget that automatically opens the document above and also the database. Then for each customer it finds its details and replaces the tags
<
<NNNNNN>
<iiiiiii>
<D1D1D1D1>
<D2D2D2D2>
<D2D2D2D2>
<D3D3D3D3>

accordingly and prints a letter for each customer.


It that what I am trying to do.
Any ideas?

Many thanks

Alex



Sure, I am doing something very similar, if a bit advanced, all the time.

Anyway, I do not believe you need that dialog for this. Just tak RichText, scan it and replace what you need Smile

OK, my method is a bit different, as I am (mis)using index entries to mark parts of document that are about to be replaced.

Anyway, for the inspiration, the heart of the code goes like this:

RichTxt Expand(const RichTxt& text, const RichStyles& styles,
               const VectorMap<String, NamedText>& map)
{
	RichText r;
	NamedText deftext;
	deftext.text = "****";
	for(int i = 0; i < text.GetPartCount(); i++) {
		if(text.IsPara(i)) {
			RichPara para = text.Get(i, styles);
			RichPara rpara;
			rpara.format = para.format;
			for(int j = 0; j < para.GetCount(); j++) {
				const RichPara::Part& p = para[j];
				if(IsNull(p.format.indexentry))
					rpara.part.Add(p);
				else {
					StringBuffer t;
					String d = map.Get(p.format.indexentry.ToString(), deftext).text;
					t << "[%CS-CZI" << p.format.indexentry.ToString() << "; " << d << ']';
					RichText txt = ParseQTF(t);
					if((txt.GetPartCount() > 1 || txt.GetPartCount() > 0 && txt.IsTable(0))
					   && rpara.GetCount() == 0) {
						for(int i = 0; i < txt.GetPartCount(); i++)
							if(txt.IsPara(i))
								r.Cat(txt.Get(i));
							else {
								RichTable tab(txt.GetTable(i), 1);
								r.CatPick(tab);
							}
						goto norpara;
					}
					else
					if(txt.GetPartCount() && txt.IsPara(0)) {
						RichPara par = txt.Get(0);
						for(int j = 0; j < par.GetCount(); j++) {
							rpara.part.Add(par[j]);
							rpara.part.Top().format = p.format;
						}
					}
				}
			}
			r.Cat(rpara);
		norpara:;
		}
		else {
			RichTable tab(text.GetTable(i), 1);
			Size sz = tab.GetSize();
			for(int q = 0; q < sz.cy; q++)
				for(int j = 0; j < sz.cx; j++) {
					RichTxt h = Expand(tab.Get(q, j), styles, map);
					tab.SetPick(q, j, h);
				}
			r.CatPick(tab);
		}
	}
	return r;
}

RichText Expand(const char *qtf, const VectorMap<String, NamedText>& map)
{
	RichText text = ParseQTF(qtf);
	RichStyles styles;
	styles <<= text.GetStyles();
	return RichText(Expand(text, styles, map), styles);
}
Re: How To Find/Replace on RichEditWithToolBar [message #16610 is a reply to message #16591] Wed, 02 July 2008 09:57 Go to previous messageGo to next message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
Hi, thank you for the tip!
The dialog is just for "print preview" when only one letter is to be "replaced/processed", thus, user can see it before printing. If more than one letter is to be processed no advantage to see it processing.

I am using Ultimate++ for making applications to deploy. I think it is a very good framework (I choose it and not choose other similar frameworks Smile ). To the best of my knowledge I think it misses a "report widget" and thus I am trying to make it using the RichText widget. So, may be on the near future, me or you or other Ultimate++ community member could implement a ready to use report widget using tags or not, using RichText or not...

Many thanks,

Alex
Re: How To Find/Replace on RichEditWithToolBar [message #16612 is a reply to message #16610] Wed, 02 July 2008 10:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Report package is of no use to you?

It was designed a the report facility. And it is used as such quite often Smile Also, check reference/Reports

Anyway, if you want something more close to RichText, there is also a bunch of RichText viewer widgets in CtrlLib.

Mirek

[Updated on: Wed, 02 July 2008 10:56]

Report message to a moderator

Re: How To Find/Replace on RichEditWithToolBar [message #16620 is a reply to message #16612] Wed, 02 July 2008 17:51 Go to previous message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
I forgot the existence of the reference\report. It could also help me.
Yes, my reports are more close to RichText (mailling letters) so I will try to use your tip to implement a method to replace tags with text (preserving the formating) using the richText widget.

Thank you again

Alex
Previous Topic: Meter or Gauge Widget out there anywhere?
Next Topic: Error: Invalid UTF-8 sequence when reading txt file from hard disk
Goto Forum:
  


Current Time: Sun May 05 20:52:12 CEST 2024

Total time taken to generate the page: 0.02149 seconds