mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:39:12 +02:00
LCL, make the grids send first typed char to external editors, issue #19306
git-svn-id: trunk@31325 -
This commit is contained in:
parent
63bc982b98
commit
54b44563d9
@ -56,6 +56,7 @@ const
|
|||||||
GM_SETMASK = LM_INTERFACELAST + 105;
|
GM_SETMASK = LM_INTERFACELAST + 105;
|
||||||
GM_SETPOS = LM_INTERFACELAST + 106;
|
GM_SETPOS = LM_INTERFACELAST + 106;
|
||||||
GM_READY = LM_INTERFACELAST + 107;
|
GM_READY = LM_INTERFACELAST + 107;
|
||||||
|
GM_GETGRID = LM_INTERFACELAST + 108;
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -64,6 +65,7 @@ const
|
|||||||
EO_HOOKKEYPRESS = $4;
|
EO_HOOKKEYPRESS = $4;
|
||||||
EO_HOOKKEYUP = $8;
|
EO_HOOKKEYUP = $8;
|
||||||
EO_SELECTALL = $10;
|
EO_SELECTALL = $10;
|
||||||
|
EO_IMPLEMENTED = $20;
|
||||||
|
|
||||||
const
|
const
|
||||||
DEFCOLWIDTH = 64;
|
DEFCOLWIDTH = 64;
|
||||||
@ -196,6 +198,7 @@ type
|
|||||||
procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID;
|
procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID;
|
||||||
procedure msg_SelectAll(var Msg: TGridMessage); message GM_SELECTALL;
|
procedure msg_SelectAll(var Msg: TGridMessage); message GM_SELECTALL;
|
||||||
procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS;
|
procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS;
|
||||||
|
procedure msg_GetGrid(var Msg: TGridMessage); message GM_GETGRID;
|
||||||
public
|
public
|
||||||
procedure EditingDone; override;
|
procedure EditingDone; override;
|
||||||
end;
|
end;
|
||||||
@ -211,6 +214,7 @@ type
|
|||||||
procedure msg_SetBounds(var Msg: TGridMessage); message GM_SETBOUNDS;
|
procedure msg_SetBounds(var Msg: TGridMessage); message GM_SETBOUNDS;
|
||||||
procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS;
|
procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS;
|
||||||
procedure msg_Ready(var Msg: TGridMessage); message GM_READY;
|
procedure msg_Ready(var Msg: TGridMessage); message GM_READY;
|
||||||
|
procedure msg_GetGrid(var Msg: TGridMessage); message GM_GETGRID;
|
||||||
public
|
public
|
||||||
property Col: Integer read FCol;
|
property Col: Integer read FCol;
|
||||||
property Row: Integer read FRow;
|
property Row: Integer read FRow;
|
||||||
@ -233,6 +237,7 @@ type
|
|||||||
procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID;
|
procedure msg_SetGrid(var Msg: TGridMessage); message GM_SETGRID;
|
||||||
procedure msg_SetValue(var Msg: TGridMessage); message GM_SETVALUE;
|
procedure msg_SetValue(var Msg: TGridMessage); message GM_SETVALUE;
|
||||||
procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS;
|
procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS;
|
||||||
|
procedure msg_GetGrid(var Msg: TGridMessage); message GM_GETGRID;
|
||||||
public
|
public
|
||||||
procedure EditingDone; override;
|
procedure EditingDone; override;
|
||||||
property BorderStyle;
|
property BorderStyle;
|
||||||
@ -263,6 +268,7 @@ type
|
|||||||
procedure msg_SelectAll(var Msg: TGridMessage); message GM_SELECTALL;
|
procedure msg_SelectAll(var Msg: TGridMessage); message GM_SELECTALL;
|
||||||
procedure CMControlChange(var Message: TLMEssage); message CM_CONTROLCHANGE;
|
procedure CMControlChange(var Message: TLMEssage); message CM_CONTROLCHANGE;
|
||||||
procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS;
|
procedure msg_SetPos(var Msg: TGridMessage); message GM_SETPOS;
|
||||||
|
procedure msg_GetGrid(var Msg: TGridMessage); message GM_GETGRID;
|
||||||
procedure VisibleChanging; override;
|
procedure VisibleChanging; override;
|
||||||
function SendChar(AChar: TUTF8Char): Integer;
|
function SendChar(AChar: TUTF8Char): Integer;
|
||||||
procedure WndProc(var TheMessage : TLMessage); override;
|
procedure WndProc(var TheMessage : TLMessage); override;
|
||||||
@ -8733,6 +8739,12 @@ begin
|
|||||||
FRow := Msg.Row;
|
FRow := Msg.Row;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TStringCellEditor.msg_GetGrid(var Msg: TGridMessage);
|
||||||
|
begin
|
||||||
|
Msg.Grid := FGrid;
|
||||||
|
Msg.Options:= EO_IMPLEMENTED;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TStringGridStrings }
|
{ TStringGridStrings }
|
||||||
|
|
||||||
function TStringGridStrings.ConvertIndexLineCol(Index: Integer; var Line, Col: Integer): boolean;
|
function TStringGridStrings.ConvertIndexLineCol(Index: Integer; var Line, Col: Integer): boolean;
|
||||||
@ -10911,6 +10923,12 @@ begin
|
|||||||
Width := DEFBUTTONWIDTH;
|
Width := DEFBUTTONWIDTH;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TButtonCellEditor.msg_GetGrid(var Msg: TGridMessage);
|
||||||
|
begin
|
||||||
|
Msg.Grid := FGrid;
|
||||||
|
Msg.Options:= EO_IMPLEMENTED;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TPickListCellEditor }
|
{ TPickListCellEditor }
|
||||||
procedure TPickListCellEditor.WndProc(var TheMessage: TLMessage);
|
procedure TPickListCellEditor.WndProc(var TheMessage: TLMessage);
|
||||||
begin
|
begin
|
||||||
@ -11082,6 +11100,12 @@ begin
|
|||||||
FRow := Msg.Row;
|
FRow := Msg.Row;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPickListCellEditor.msg_GetGrid(var Msg: TGridMessage);
|
||||||
|
begin
|
||||||
|
Msg.Grid := FGrid;
|
||||||
|
Msg.Options:= EO_IMPLEMENTED;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCompositeCellEditor }
|
{ TCompositeCellEditor }
|
||||||
|
|
||||||
procedure TCompositeCellEditor.DispatchMsg(msg: TGridMessage);
|
procedure TCompositeCellEditor.DispatchMsg(msg: TGridMessage);
|
||||||
@ -11194,6 +11218,12 @@ begin
|
|||||||
DispatchMsg(Msg);
|
DispatchMsg(Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCompositeCellEditor.msg_GetGrid(var Msg: TGridMessage);
|
||||||
|
begin
|
||||||
|
Msg.Grid := FGrid;
|
||||||
|
Msg.Options:= EO_IMPLEMENTED;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCompositeCellEditor.VisibleChanging;
|
procedure TCompositeCellEditor.VisibleChanging;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
@ -44,7 +44,7 @@ uses
|
|||||||
// To get as little as posible circles,
|
// To get as little as posible circles,
|
||||||
// uncomment only when needed for registration
|
// uncomment only when needed for registration
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
Controls, LCLType, Grids,
|
LCLType, Controls, StdCtrls, Grids,
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
WSLCLClasses, WSControls, WSFactory;
|
WSLCLClasses, WSControls, WSFactory;
|
||||||
|
|
||||||
@ -72,13 +72,33 @@ class procedure TWSCustomGrid.SendCharToEditor(AEditor:TWinControl;
|
|||||||
Ch: TUTF8Char);
|
Ch: TUTF8Char);
|
||||||
var
|
var
|
||||||
GMsg: TGridMessage;
|
GMsg: TGridMessage;
|
||||||
|
GridEditor: boolean;
|
||||||
begin
|
begin
|
||||||
|
GMsg.Grid := nil;
|
||||||
|
GMsg.Options:= 0;
|
||||||
|
GMsg.LclMsg.Msg:=GM_GETGRID;
|
||||||
|
AEditor.Dispatch(GMsg);
|
||||||
|
GridEditor := (GMsg.Options and EO_IMPLEMENTED<>0) and (GMsg.Grid<>nil);
|
||||||
|
|
||||||
GMsg.LclMsg.Msg:=GM_SETVALUE;
|
GMsg.LclMsg.Msg:=GM_SETVALUE;
|
||||||
if Ch=#8 then // backspace
|
if Ch=#8 then // backspace
|
||||||
GMsg.Value:=''
|
GMsg.Value:=''
|
||||||
else
|
else
|
||||||
GMsg.Value:=Ch;
|
GMsg.Value:=Ch;
|
||||||
AEditor.Dispatch(GMsg);
|
|
||||||
|
if GridEditor then
|
||||||
|
AEditor.Dispatch(GMsg)
|
||||||
|
else begin
|
||||||
|
// TODO: Find a generic way ...
|
||||||
|
if AEditor is TCustomEdit then begin
|
||||||
|
TCustomEdit(AEditor).Text:=GMsg.Value;
|
||||||
|
TCustomEdit(AEditor).SelStart:=UTF8Length(GMsg.Value);
|
||||||
|
end else
|
||||||
|
if AEditor is TCustomCombobox then begin
|
||||||
|
TCustomCombobox(AEditor).Text:=GMsg.Value;
|
||||||
|
TCustomCombobox(AEditor).SelStart:=UTF8Length(GMsg.Value);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWSCustomGrid.InvalidateStartY(const FixedHeight, RowOffset: Integer): Integer;
|
class function TWSCustomGrid.InvalidateStartY(const FixedHeight, RowOffset: Integer): Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user