add can quickly setting filter columns name

guxinglei's profile image guxinglei posted 4 hours ago in General Permalink

procedure TMainForm.DataGridHeaderMouseDown(Sender: TVTHeader; Button: TMouseButton; Shift: TShiftState; X, Y: TDimension); var Header: THeader; begin FillChar(FHitInfo, SizeOf(FHitInfo), 0); with DataGrid do begin GetHitTestInfoAt(X, Y, True, FHitInfo); end; end;

procedure SetTextAtCurrentMousePosition(SynEdit: TSynMemo; const Text: string); var CurrentPos: Integer; begin CurrentPos := SynEdit.SelStart; SynEdit.SelText := Text; SynEdit.SelStart := CurrentPos + Length(Text); SynEdit.SelLength := 0; end;

procedure TMainForm.DataGridHeaderMouseUp(Sender: TVTHeader; Button: TMouseButton; Shift: TShiftState; X, Y: TDimension); var MousePos: TPoint; S:string; begin GetCursorPos(MousePos); MousePos := SynMemoFilter.ScreenToClient(MousePos); if PtInRect(SynMemoFilter.ClientRect, MousePos) then begin S := DataGrid.Header.Columns.Items[FHitInfo.HitColumn].Text; SetTextAtCurrentMousePosition(SynMemoFilter,S); end; end;

Please login to leave a reply, or register at first.