procedure TPgCtrlChildVST1Grid.vstKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
Var
ANode :PVirtualNode;
OldNode :PVirtualNode;
I :Integer;
AKey :Word;
AShift :TShiftState;
SavedKey :Word;
SavedShift :TShiftState;
AMessage :TLMessage;
begin
SavedKey := 0;
SavedShift := [];
If (NOT TVirtualStringTree(Sender).IsEditing) then
begin
If b_GridEnterAdvances and (Key = vk_Return) and (Shift = [])
then begin
{Code to move to the next column when the Return key is pressed}
end
else begin
If b_GridAtoZStartsEditing
AND
(
((Shift = []) and (Char(Key) in ['0'..'9', 'A'..'Z']))
OR
((Shift = [ssShift]) and (Char(Key) in ['A'..'Z']))
)
then begin
(*****
{This invokes the Edit control but does NOT enter the character into the Edit control}
If NOT TVirtualStringTree(Sender).IsEditing then
begin
AKey := VK_F2;
AShift := [];
vstKeyDown(Sender, AKey, AShift);
end;
*****)
(*******)
{Save the key, enter edit mode then ? re-post/re-send key to the edit control}
SavedKey := Key;
SavedShift := Shift;
Key := 0; {So that nothing is done when this procedure exits unless Key is set to its original value.}
{Start editing the Node then try to re-send the
same character / message to the editor.}
If TVirtualStringTree(Sender).EditNode(
TVirtualStringTree(Sender).FocusedNode
, TVirtualStringTree(Sender).FocusedColumn) then
begin
{After the editor is started pass the original key through.}
//Key := SavedKey;
//Shift := SavedShift;
{
NO ERROR, BUT the character is NOT entered into the editor / edit control.
}
{After the editor is started post original message the the VST.}
//PostMessage(TVirtualStringTree(Sender).Handle, LM_KEYDOWN, SavedKey, ShiftStateToKeys(SavedShift));
{
NO ERROR, BUT the character is NOT entered into the editor / edit control.
Debugger indicates the VirtualStringTree does not have a "Handle" property,
BUT VST is a TCustomControl descendant which is a TWinControl descendant so it should have a Handle propery.
}
{After editor started have the EditLink process the original message.}
//AMessage.Msg := LM_KEYDOWN;
//AMessage.WParam := SavedKey;
//AMessage.LParam := ShiftStateToKeys(SavedShift);
//TmtrsVTELBase(TVirtualStringTree(Sender).EditLink).ProcessMessage(AMessage);
{
ERROR IS: "External SIGSEGV", which occurs in the EditLink's
ProcessMessages procedure shown below.
procedure TmtrsVTELBase.ProcessMessage(var Message: TLMessage); stdcall;
begin
>>>>>> FEdit.WindowProc(Message); <<<<<<<
end;
}
{After editor started post original message the the Editor / Edit control.}
//PostMessage(TmtrsVTELBase(TVirtualStringTree(Sender).EditLink).Edit.Handle, LM_KEYDOWN, SavedKey, ShiftStateToKeys(SavedShift));
{
ERROR IS: "External SIGSEGV"
}
{In all four cases above the Editlink and the Edit have been
assigned valid values after the EditNode procedure is executed.}
end;
(******)
end;
end;
end;
//Inherited;
end;