trichview.com

trichview.support




Re: Tables


Return to index


Author

Message

Sergey Tkachenko

Posted: 02/22/2002 11:36:16


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.


>

> Hello,

>

> I have a table which contains cells having each one controls (TLabel).

> when I click on one of the TLabel controls, the cell is not put in edition

> mode.

> I thus cannot obtain the infos with the GetCurrent

> commands.....

>

> How Can I make to make active a cell when I click on a control contained

> in this one

>

> Thank's





Powered by ABC Amber Outlook Express Converter