08-27-2009, 04:05 PM
Hi Gintaras,
I have a dialog with an edit box which gets populated by with text that has been selected by the user in a richeditfield in another application
The user can then edit the text in my QM dialog and then replace the original selected text with a dialog button.
To replace the text back in the original (the problem step), I do the following:
[code](`t)str(`) EditedText.getwintext(`p)((`)(`fq)id(`)(`p)((`)(`n)4(`) hDlg(`p)))(`)
(`t)int(`) SelectedTextIndex (`o)=(`) (`fq)findw(`)(`p)((`)PreEditedReport SelectedText(`p))(`)
(`t)str(`) PostEditedReport (`o)=(`) PreEditedReport
PostEditedReport.findreplace(`p)((`)SelectedText EditedText (`n)4(`) (`s)""(`) SelectedTextIndex(`p))(`)
(`fq)act(`) (`fq)child(`)(`p)((`)reportcid (`s)""(`) SampleAppWindowsFormsRichEdit20W SampleAppHwnd (`n)0x5(`)(`p));(`)(`fq)err(`) (`fq)ret(`)
(`p)'(`)Ca
(`n)0.1(`)
(`fq)outp(`) PostEditedReport(`p)
It works great if the selected text is all within one line (i.e. doesn't have carriage returns like these [][]), but if it is multi-line, the [][]'s cause a failure at the findreplace stage.
e.g.
Original text may look like this:
and the edited text may look like this
but it gets changed to
When I made the edit box in my dialog a simple edit box, those [][]'s would appear but if I make it into a rich edit box, they don't appear. If I didn't have to put them back into the text, that would be fine, but since I do, there is problem.
Whether I escape the characters e.g. EditedText.escape(0), or not..it doesn't seem to work. I am not sure at what stage the [][]'s are getting back in and causing the failure of the findreplace....or maybe they do need to be in to do a proper findreplace.
I feel like I am going around in circles....
Any ideas.....?
Thanks!!!
Stuart
I have a dialog with an edit box which gets populated by with text that has been selected by the user in a richeditfield in another application
act child("" SampleAppWindowsFormsRichEdit20W SampleAppHwnd 0x5);err ret
str+ SelectedText = ""
SelectedText.getsel
The user can then edit the text in my QM dialog and then replace the original selected text with a dialog button.
To replace the text back in the original (the problem step), I do the following:
[code](`t)str(`) EditedText.getwintext(`p)((`)(`fq)id(`)(`p)((`)(`n)4(`) hDlg(`p)))(`)
(`t)int(`) SelectedTextIndex (`o)=(`) (`fq)findw(`)(`p)((`)PreEditedReport SelectedText(`p))(`)
(`t)str(`) PostEditedReport (`o)=(`) PreEditedReport
PostEditedReport.findreplace(`p)((`)SelectedText EditedText (`n)4(`) (`s)""(`) SelectedTextIndex(`p))(`)
(`fq)act(`) (`fq)child(`)(`p)((`)reportcid (`s)""(`) SampleAppWindowsFormsRichEdit20W SampleAppHwnd (`n)0x5(`)(`p));(`)(`fq)err(`) (`fq)ret(`)
(`p)'(`)Ca
(`n)0.1(`)
(`fq)outp(`) PostEditedReport(`p)
It works great if the selected text is all within one line (i.e. doesn't have carriage returns like these [][]), but if it is multi-line, the [][]'s cause a failure at the findreplace stage.
e.g.
Original text may look like this:
Quote:This is line 1
This is line 2
and the edited text may look like this
Quote:This is line 1
interspersed text
This is line2
but it gets changed to
Quote:This is line 1[][]interspersed text[][]This is line2
When I made the edit box in my dialog a simple edit box, those [][]'s would appear but if I make it into a rich edit box, they don't appear. If I didn't have to put them back into the text, that would be fine, but since I do, there is problem.
Whether I escape the characters e.g. EditedText.escape(0), or not..it doesn't seem to work. I am not sure at what stage the [][]'s are getting back in and causing the failure of the findreplace....or maybe they do need to be in to do a proper findreplace.
I feel like I am going around in circles....
Any ideas.....?
Thanks!!!
Stuart