Hello Sergey,
This subject is very interesting to me.
I have some footnotes from my text, I'd like to know whether it is possible when my mouse is over of each footnote number in my text, it appears as a hint with my footnote text for that footnote number.
Did you understand?
Show the FootNote text as a hint, is it possible?
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
-
- Posts: 75
- Joined: Fri Jan 06, 2012 8:13 pm
Hi
This is a simple way:
This is a simple way:
Code: Select all
function GetFntStr(fntNO:integer;rv:TRichViewEdit):string;
var NoteItem: TCustomRVNoteItemInfo;
stream:TmemoryStream;
s:string;
begin
if fntNo>=0 then
if rv.GetItem(fntNo) is TCustomRVNoteItemInfo then begin
stream:=TmemoryStream.Create;
NoteItem:=(rv.GetItem(fntNo) as TCustomRVNoteItemInfo);
NormalizeRichView (NoteItem.Document);
noteitem.Document.SaveTextToStream('',stream,0,false,true,true,true,0);
stream.Position:=0;
setlength(s,stream.Size div 2);
Stream.ReadBuffer(PWideChar(s)^, Stream.Size);
Stream.Clear;
Stream.Free;
result:=s;
end;
end;
procedure TForm1.rvMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
LRVData: TCustomRVFormattedData;
LWord: String;
LItemNo : Integer;
begin
TCustomRichViewEdit(sender).GetWordAt(x,y,LRVData,LItemNo,LWord);
if LItemNo>=0 then begin
if rv.GetItem(LItemNo) is TCustomRVNoteItemInfo then begin
TCustomRichViewEdit(sender).Cursor:=101;
rv.Hint:=GetFntStr(LItemNo,rv);
rv.ShowHint:=True;
end
else begin
rv.Hint:='';
rv.ShowHint:=False;
TCustomRichViewEdit(sender).Cursor:=102;
end;
end else begin
TCustomRichViewEdit(sender).Cursor:=102;
rv.Hint:='';
rv.ShowHint:=False;
end;
end;
-
- Site Admin
- Posts: 17561
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm
Hello Sergey,
I tried to do what you gave me but I haven't had any success so far.
I tried to do that with DBSRichViewEdit.
Another thing
When I open the event onItemHint, the Delphi complained:
[Error] Unit1.pas(183): Undeclared identifier: 'TCustomRichView'
from the function
Sergey, is it possible to make an example with DBSRichView?
I tried to do what you gave me but I haven't had any success so far.
I tried to do that with DBSRichViewEdit.
Another thing
When I open the event onItemHint, the Delphi complained:
[Error] Unit1.pas(183): Undeclared identifier: 'TCustomRichView'
from the function
Sergey, is it possible to make an example with DBSRichView?
-
- Site Admin
- Posts: 17561
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
uses CRVData, RichView, RVGetTextW, RVNote;
// for Delphi 4-2007, use RVGetText instead of RVGetTextW
procedure TForm1.DBSRichViewEdit1ItemHint(Sender: TCustomRichView;
RVData: TCustomRVData; ItemNo: Integer; var HintText: string);
begin
if RVData.GetItem(ItemNo) is TCustomRVNoteItemInfo then
HintText := GetRVDataText(TCustomRVNoteItemInfo(RVData.GetItem(ItemNo)).Document);
end;
1) Include rvoShowItemHints in DBSRichViewEdit1.RVOptions
2) Assign DBSRichViewEdit1.ShowHint := True
-
- Posts: 184
- Joined: Wed Jan 18, 2012 6:22 pm