First thing TString Grid is one complicated best and a massive under tacking
for any one to take on - no ones perfect okey
I think the internal moving parts of this TStringGird is way better than the Delphi 7 version so I’m not putting it down because this is a beast of an object?
TStringGrid locks its self as full and only focus on the form
You cannot do that inside Objects !!!
you cannot put another object over the Grid with SetFocusedControl(Grid) like that in this event. The mouse down having SetFocus is what should be their as it is but may set the WM_SETFOCUS message. the problem is this is getting called all the time.
I ask the question should their be be a FGridHasFocus value in the grid and only on true that SetFocusedControl(Grid) is called in the WM_SETFOCUS message. And a loose focus event sets the FGridHasFocus to False.
procedure TInplaceEdit.WndProc(var Message: TMessage);
begin
case Message.Msg of
WM_SETFOCUS:
begin
if (GetParentForm(Self) = nil) or GetParentForm(Self).SetFocusedControl(Grid) then
Dispatch(Message);
Exit;
end;
WM_LBUTTONDOWN:
begin
if UINT(GetMessageTime - FClickTime) < GetDoubleClickTime then
Message.Msg := WM_LBUTTONDBLCLK;
FClickTime := 0;
end;
end;
inherited WndProc(Message);
end;
Removing this focus lock from the form
means take any screen object example TEdit. Border style := bsNone, find a cell’s rect and put the editor in it. hide or move the edit when the grid moves
no problems
I found the Inplaceeditor close in the editor object and gave an event
1/ put the editor text into the focused cell
2/ enable program control linked from TStringGrid
Should people want to use the Inplaceeditor
may code needs this update
procedure TCustomGrid.CloseEdit;
Var
aText: string;
UpdateEdit: Boolean;
begin
UpdateEdit := True;
aText := InplaceEditor.FGrid.Text;
If Assigned(OnCloseEditEvent) then
FOnCloseEditEvent(Self, Selection.Left, Selection.Top, aText, UpdateEdit);
If UpdateEdit then
InplaceEditor.FGrid.Text := aText;
end;
you are using the mask editor in the Grid so you could offer the mask to programmers and clear the mask as the inplaceeditor is moved?
I notice the fixed cells color is white and not the button face color at run time
I do not know why is that?
Why is TStringGrid not able to be set 1 fixedRow (Title Row) and no other rows below it? Then the programmer as rows as information is available to put in?
I know that is a difficult question.
One last thing - is it necessary to hide the access to the InplaceEditor from programmers?
[ attachment removed - copyright issues]