trichview.support
Re: Embedded control as CurItemNo |
Author |
Message |
Justin Turberville |
Posted: 03/26/2002 19:32:19 I did scan for something similar... I try not to be pedantic, but surely CurItemNo should return the item that the caret is in, which would be the item of the embedded component if that is what the user has selected (come on, admit it ;) - in the light of which the routine below looks more like a bug workaround, not that I'm not grateful for it. I presume finding a way of notifying RV that an embedded control has been selected to place the caret there is problematic. "Sergey Tkachenko" <[email protected]> wrote in message news:[email protected]... > This question was asked some time ago. > > Answer is below: > > ========== > > Assign this code to the control's OnClick: > > // assuming that editor's name = RichViewEdit1. > procedure TForm1.DoControlClick(Sender: TObject); > > procedure FindControlLocation(var RVData: TCustomRVData; var ItemNo: > Integer); > var table: TRVTableItemInfo; > r,c: Integer; > begin > if ItemNo<0 then > ItemNo := RVData.FindControlItemNo(TControl(Sender)); > if ItemNo<0 then begin > RVData := nil; > ItemNo := -1; > end > else if RVData.GetItemStyle(ItemNo)=rvsComponent then begin > // found > end > else begin > table := TRVTableItemInfo(RVData.GetItem(ItemNo)); > table.GetCellWhichOwnsControl(TControl(Sender), r,c, ItemNo); > RVData := table.Cells[r,c].GetRVData; > FindControlLocation(RVData, ItemNo); > end; > end; > > var RVData: TCustomRVData; > ItemNo : Integer; > begin > RVData := RichViewEdit1.RVData; > ItemNo := -1; > FindControlLocation(RVData, ItemNo); > if (RVData is TRVTableCellData) then > TRVTableCellData(RVData).Edit; > TCustomRVFormattedData(RVData.GetRVData).SetSelectionBounds(ItemNo, 1, > ItemNo, 1); > end; > > Well, I think that I need to add FindControlLocation to the methods of > RichView. > > ========== > > > After clicking on an embedded control, CurItemNo still seems to return the > > last selected text item instead of the item containing the control. Is > this > > the intended behavour or am I missing something or is it a bug? I need be > > able to get at the tag of the item double clicked on even if it is an > > embedded control item. > > > > > > |
Powered by ABC Amber Outlook Express Converter