View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004782 | JEDI VCL | 00 JVCL Components | public | 2009-05-21 09:58 | 2009-09-23 17:09 |
Reporter | tetardd | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | 3.39 | |||
Summary | 0004782: jvRichEdit - Create GetTextlenEx function | ||||
Description | The current method to get the length of the content for printing (EM_FormatRange) is: 3891 if RichEditVersion >= 2 then 3892 begin 3893 with TextLenEx do 3894 begin 3895 Flags := GTL_DEFAULT; 3896 codepage := CP_ACP; 3897 end; 3898 MaxLen := Perform(EM_GETTEXTLENGTHEX, WParam(@TextLenEx), 0); 3899 end 3900 else 3901 MaxLen := GetTextLen; This seems to imply that calling GetTextlen is not valid for versions 2 and above. Therefore, it means that for version 2 and above, one cannot print reliably the RTF content using the EM_FORMATRANGE in our own canvas (for example, if I have a print preview control) as we'd have to dig in the code of TJvRichEdit to discover that GetTextLen (public) is rubbish. I suggest the following: Create a ***public*** GetTextLenEx function that is like this: Function GetTextLenEx : Integer; Var TextLenEx: TGetTextLengthEx; Begin if RichEditVersion >= 2 then begin with TextLenEx do begin Flags := GTL_DEFAULT; codepage := CP_ACP; end; Result := Perform(EM_GETTEXTLENGTHEX, WParam(@TextLenEx), 0); end else Result := GetTextLen; End; and in method print, do only: MaxLen := GetTextlenEx; to replace lines 3891 to 3901. and maybe mark GetTextLen as deprecated. | ||||
Tags | No tags attached. | ||||
|
Could you please provide the zipped sources of a sample application showing this? |
|
Hello, any news? |
|
No need for an example to show this. I have an app with several controls holding user data, e.g. a series of TEdit, TStringGrid, etc., one of them being a TJvRichEdit. To print my data in one overal document, I have to use the printer canvas and print the text in the TEdits, the lines in the TStringGrid, etc, in the order they are on the screen, one data after the other. When I therefore have to print the content of the TJvRichEdit on the canvas, I have to use EM_FORMATRANGE to print on that canvas. For this of course, I hit the problem described above. Remember: A TJvRichEdit does not always have to be a single standalone control whose content is always printed using TJvRichEdit.Print but can be part of a more complex UI with a complex set of controls and therefore may have to be printed using more low-level calls to EM_FORMATRANGE. |
|
Without an example, I cannot test. If I cannot test, I cannot try to solve... |
|
Sorry, it seems I'm failing to communicate something quite obvious it seems. Have a look at this: http://edn.embarcadero.com/article/26772, this is exactly what I'm requesting, but make the GetPreciseTextLen a public function of TjvRichEdit. Also, try to think about the need people have to provide print previews in their app. How do you do that properly with TjvRichEdit, given the embarcadero doc.? |
|
Thanks for the details, this is now in SVN. |
Date Modified | Username | Field | Change |
---|---|---|---|
2009-05-21 09:58 | tetardd | New Issue | |
2009-07-06 14:11 | obones | Status | new => acknowledged |
2009-07-09 10:21 | obones | Note Added: 0015797 | |
2009-07-09 10:21 | obones | Status | acknowledged => feedback |
2009-08-04 09:37 | obones | Note Added: 0015903 | |
2009-08-09 11:54 | tetardd | Note Added: 0015969 | |
2009-08-09 18:50 | obones | Note Added: 0015970 | |
2009-08-09 20:55 | tetardd | Note Added: 0015971 | |
2009-09-23 17:09 | obones | Note Added: 0016165 | |
2009-09-23 17:09 | obones | Status | feedback => resolved |
2009-09-23 17:09 | obones | Fixed in Version | => Daily / SVN |
2009-09-23 17:09 | obones | Resolution | open => fixed |
2009-09-23 17:09 | obones | Assigned To | => obones |