Control.Parent := Grid;
Control.BoundsRect := Grid.CellRect(LastfocusedCol, LastfocusedRow);
Control.Visible := True;
I have a number of different types of edits So using a common parent is a easy way so far to work from. The edits are called for may different uses with a click from TStringGrid but I cannot give the edit what ever edit to take focus and show the carrot to start typing text or what ever
I’m using these edits because of these edit services
OnExit and on enter as the focus is changed to another screen object
can do that with the grids in place editor
cannot offer a spin edit date time … with TStringGrid
procedure TForm1.ShowEdit(Control: TWinControl);
begin
If Control = Nil then exit;
Control.Parent := Grid;
Control.BoundsRect := Grid.CellRect(LastfocusedCol, LastfocusedRow);
Control.Visible := True;
PostMessage(Grid.Handle, WM_KillFocus, 0, 0);
Control.SetFocus;
PostMessage(Control.Handle, WM_SETFOCUS, 0, 0);
end;
I’m running on the
procedure TForm1.GridMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
the .GridMouseUp executes the ShowEdit procedure
But still the grid is holding the focus and will not release the focus
Di i Need ttimer? or what
I found my problem
BoundsRect does not work at all !!!
It receives a TRect value but no way does it work at all - it destroys the editor as a visible component its not working correctly at the TControl level