trichview.support
Re: A few questions |
Author |
Message |
Sergey Tkachenko |
Posted: 11/19/2003 12:28:57 Thank you for help, Gennady > > procedure TForm1.RVEMouseMove(Sender: TObject; Shift: TShiftState; X, Y: > Integer); > var rvd: TCustomRVFormattedData; > i, io, StyleNo: integer; > > begin > if RVE.GetItemAt(x+(RVE.HScrollPos*10), y+(RVE.VScrollPos*10), rvd, i, > io, true) then > begin > StyleNo:=RVE.GetItemStyle(i); > // your code > end; > end; It's not completely correct. Yes, the source of the problem is a difference in coordinates. X and Y parameters are relative to the top left corner of RichViewEdit window, but GetItemAt requires coordinates relative to the top left corner of document (scrollable area). Correct call: RVE.GetItemAt(x+RVE.HScrollPos, y+RVE.VScrollPos*RVS.VSmallStep, rvd, i, io, true) The second mistake: you need to use rvd, not RVE to access items (a difference will be when clicking in a table cell). procedure TForm1.RVEMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var rvd: TCustomRVFormattedData; i, io, StyleNo: integer; begin if RVE.GetItemAt(x+RVE.HScrollPos, y+RVE.VScrollPos*RVS.VSmallStep, rvd, i, io, true) then begin StyleNo:=rvd.GetItemStyle(i); // your code end; end; > >2.Is it possible to click on a picture(not bullet and others) > >and get it to shellexecute? How do I do this? I suppose I need to add a > hotspot > >to the picture. How can I achieve this? If this is a hypertext item, you can use OnJump event. procedure TMyForm.MyRichViewJump(Sender: TObject; id: Integer); var ItemNo: Integer; RVData: TCustomRVFormattedData; s: String; begin MyRichView.GetJumpPointLocation(id, RVData, ItemNo); s := PChar(RVData.GetItemTag(ItemNo)); Application.MessageBox(PChar(s), 'Link', MB_OK or MB_ICONINFORMATION); end; If not, you can use GetItemAt in OnRVMouseUp, like in the example above. |
Powered by ABC Amber Outlook Express Converter