StringGrid - SelText?

0

Nie mogę tego nigdzie znaleźć. Jeżeli w Options StringGrida mamy ustawione goAlwaysShowEdytor, to możemy tekst zaznaczać jak w kontrolce edycyjnej - tylko czy możemy to robić programowo? Jest tu jakieś SelStart, SelLength? Chcę uzyskać autouzupełnianie podobne do tego w Excelu. Pomóżcie!!!!!

0

Zobacz w Helpie TStringGrid.OnGetEditText i TStringGrid.OnSetEditText.

0

chyba to nietędy droga, ale jestem już blisko jak zrobię to wrzucę

0
//SG:TStringGrid;
//SG.Options:=SG.Options+[goEditing,goAlwaysShowEditor]
function GetStringGridSelText(SG:TWinControl;aCol,aRow:Integer):string;
var
  Wnd,SelStart,SelEnd:Integer;
begin
  Wnd:=GetWindow(SG.Handle,GW_CHILD);
  SendMessage(Wnd,EM_GETSEL,Integer(@SelStart),Integer(@SelEnd));
  Result:=Copy((SG as TStringGrid).Cells[aCol,ARow],SelStart+1,SelEnd-SelStart);
end;
0

I jeszcze zaznaczanie tekstu:

procedure SetStringGridSelText(SG:TWinControl;aCol,aRow,SelStart,SelLength:Integer);
var
  Wnd:Integer;
begin
  Wnd:=GetWindow(SG.Handle,GW_CHILD);
  SendMessage(Wnd,EM_SETSEL,SelStart,SelStart+SelLength);
  SG.SetFocus;
end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1