trichview.support
Re: Selecting a Component |
Author |
Message |
Sergey Tkachenko |
Posted: 03/05/2003 0:18:23 Hi, Use the procedure below to select control procedure SelectControl(rve: TCustomRichViewEdit; ctrl: TControl); function SelectControl_(RVData: TCustomRVData; ctr: TControl): Boolean; var i,r,c: Integer; table: TRVTableItemInfo; begin Result := False; for i := 0 to RVData.ItemCount-1 do case RVData.GetItemStyle(i) of rvsComponent: begin Result := TRVControlItemInfo(RVData.GetItem(i)).Control=ctrl; if Result then begin RVData := RVData.Edit; TCustomRVFormattedData(RVData).SetSelectionBounds(i,0,i,1); TCustomRVFormattedData(RVData).Invalidate; exit; end; end; rvsTable: begin table := TRVTableItemInfo(RVData.GetItem(i)); for r := 0 to table.Rows.Count-1 do for c := 0 to table.Rows[r].Count-1 do if table.Cells[r,c]<>nil then begin Result := SelectControl_(table.Cells[r,c].GetRVData, ctrl); if Result then exit; end; end; end; end; begin SelectControl_( rve.RVData, ctrl); end; > Hi, > > I have created a few custom components that I am currently using in the > RichView editor. What I am trying to do is to set a focus rectangle around > the component when I double click it. > > Currently I am using the TRichViewEdit.GetItemAt using the Left and Top of > the component then calling TRichViewEdit.SetSelectionBounds. But this causes > problems if my component is the only item on the page. > > Is this the best way to do this or should I be doing it another way? > > Regards > Ben > > |
Powered by ABC Amber Outlook Express Converter