trichview.com

trichview.support




Re: What cell did I click?


Return to index


Author

Message

Sergey Tkachenko

Posted: 03/03/2002 23:05:55


Yes, table.GetEditedCell returns cell which is currently edited.

It can be used only in TRichViewEdit, because in TRichView cannot edit

cells.


But getting a clicked cell is not really a complex task.


Example:


procedure TForm1.RichViewEdit1RVMouseDown(Sender: TCustomRichView;

  Button: TMouseButton; Shift: TShiftState; ItemNo, X, Y: Integer);

var x2,y2,r,c: Integer;

begin

  if ItemNo<0 then exit;

  if Sender.GetItemStyle(ItemNo)=rvsTable then begin

    Sender.GetItemClientCoords(ItemNo,x2,y2);

    if TRVTableItemInfo(Sender.GetItem(ItemNo)).GetCellAt(X-x2,Y-y2, r, c)

then

      Caption := Format('%d %d', [r,c]); // show Row and Column indices

  end;

end;


This method will not work for nested tables, though.


> Investigating helps.. found  GetEditedCell()

>

> Atle

>

> "Atle Kåven" <atlek@ZZarcticnet.no> wrote in message

> news:3c825807$1@support.torry.net...

> > I'm trying to figure out how to find the Col and Row number of the cell

> just

> > clicked, but it seems to be a lot of looping to get this information. Am

I

> > right or are there some functions that can return this for me. ?

> >

> > Atle

> >

> >

>

>







Powered by ABC Amber Outlook Express Converter