| View previous topic :: View next topic |
| Author |
Message |
cakk
Joined: 17 Dec 2009 Posts: 14
|
Posted: Wed May 19, 2010 11:53 pm Post subject: Question about the chat demo |
|
|
I download the chat demo at :
Advanced demo with rich text text input
http://www.trichview.com/support/files/chatcodeswysiwyg.zip
and it works fine. But I have 2 questions about it:
1.Why the HScrollVisible and VScrollVisible of rv have no effect? I set them to True, but the scrollbar is still hidden. Just when the text too long to going to scroll, it is showing. How can I set the scrollbar visible always, even if the text is empty?
2.How can I made the rv support "returns"? When I paste multi-line text into rve, and click "send", then the text will show in rv, but all of return(CRLF) are missing.
Thanks! |
|
| Back to top |
|
 |
Sergey Tkachenko Site Admin
Joined: 27 Aug 2005 Posts: 6607
|
Posted: Thu May 20, 2010 9:54 am Post subject: |
|
|
1) If *ScrollVisible=True, scrollbars are displayed only when necessary.
If they are False, scrollbars are never displayed.
TRichView has no mode for displaying scrollbars when they are not necessary (unlike TRichViewEdit that always displays vertical scrollbar).
2) This demo inserts ' | ' instead of line breaks. You can see the code in TForm1.Encode:
| Code: | if (i>0) and rve.IsFromNewLine(i) then
Result := Result +' | '; |
How to support line breaks.
a) Exclude rvoDoNotWantReturns from rve.EditorOptions.
In FormCreate, change the assignment to rve.EditorOptions:
| Code: | rve.EditorOptions := rve.EditorOptions+[rvoNoImageResize]-
[rvoDoNotWantReturns,rvoWantTabs]; |
b) Change rve.OnKeyDown to send message on Ctrl+Return instead of Return:
| Code: | procedure TForm1.rveKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
...
if (Key=VK_RETURN) and (Shift=[ssCtrl]) and (rve.InplaceEditor=nil) then begin
btnEnterClick(nil);
Key := 0;
end;
end; |
c) Change TForm1.Encode to insert #13 instead of ' | ':
| Code: | if (i>0) and rve.IsFromNewLine(i) then
Result := Result +#13; |
d) Change TForm1.ParseString:
| Code: | ...
for i := 1 to Length(s) do begin
if s[i]=#13 then begin
AddStringWithURLs(StartIndex, i-1);
ParaNo := 0;
ReadState := rsNormal;
StartIndex := i+1;
continue;
end;
if i>=StartIndex then
case ReadState of
...
end;
end;
AddStringWithURLs(StartIndex, Length(s));
end; |
Empty lines will still not be inserted. But I think this is good, because it prevents flooding. |
|
| Back to top |
|
 |
cakk
Joined: 17 Dec 2009 Posts: 14
|
Posted: Thu May 20, 2010 11:10 am Post subject: |
|
|
ok! its works fine!! Thanks a lots!  |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|