Page 1 of 1

set selected text into a rveTable-cell

Posted: Sat Jul 11, 2009 2:24 pm
by j&b
Hello,

I want to set selected text into a rvetable (with 1 row and 1 col).

During program runs through table (for i:= von to bis) I can see the selected text (showMessage(...) in the wanted rveTable. If running through table is finished I scroll to another record and then back to look for inserted text. But text is vanished.

Problem solved. See next post (only for those who are interessted how to move caret to the beginning/end of a rveTable-cell).

Re: set selected text into a rveTable-cell

Posted: Sun Jul 12, 2009 8:32 am
by j&b
I think I have found a solution about ',moving caret to the beginning/end of a cell' - from Sergey for a long time ;-):

...
try
for i:= von to bis do begin //Records
if i<>po1 then begin //po1 AusgangsRecord auslassen
if memo.CanFocus then memo.setFocus
else if grid1.CanFocus then grid1.setfocus;

if wahl=2 then begin //1zelligeTabelle to 1z. Tab
setRveTabNo;
if SetRveFlag= true then exit;
if (not memo.CanChange) or (not memo.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(rveTable))) then exit;
if rveTable.Rows[0].Count<>1 then begin
ShowMessage('Sie haben anscheinend keine einzellige ''Ziel-Tabelle'' gewählt.'+#10+
'Es wird daher abgebrochen');
exit;
end;
if (rveTable.Cells[0,0]<>nil) then begin
RVData := TCustomRVFormattedData(rveTable.Cells[0,0].Edit);
if ort= 'anfang' then //Caret an den CellAnfang --------------------------------------------
RVData.SetSelectionBounds(0, RVData.GetOffsBeforeItem(0), 0, RVData.GetOffsBeforeItem(0))
else if ort= 'ende' then //Caret ans CellEnde -------------------------------------------------
RVData.SetSelectionBounds(RVData.ItemCount-1, RVData.GetOffsAfterItem(RVData.ItemCount-1), RVData.ItemCount-1, RVData.GetOffsAfterItem(RVData.ItemCount-1));
end;
end else begin //memo2memo
if ort='anfang' then RVSetLinearCaretPos(memo,0)
else if ort='ende' then memo.SetSelectionBounds(memo.ItemCount-1,1,memo.ItemCount-1,1);
end;
memo.paste;
end;
if i<bis then table1.next;
end; //for i:= von to bis
if table1.state=dsEdit then table1.post;
finally
memo.deselect;
end;
...