Hola!
Estoy intentando que un TAdvRichEditor me reconozca la tecla tab para insertar tabulaciones. Y no es que no haga las tabulaciones, es que parece que no me reconoce ni la pulsación, en cambio otras teclas como la de retorno de carro sí la reconoce.
Como veis puse WantTab True, ya que si no al pulsar la tecla TAB se me movía por todas las pestañas del formulario.
Código Delphi
[-]
Procedure TConexion.CrearTab(Params: TParametrosTab);
var
Key: TScKey;
begin
FLog := Params.Log;
FDockSite := Params.DockSite;
FTab := TLMDDockPanel.Create(FDockSite);
FTab.ClientKind := dkDocument;
FTab.Caption := 'TEST';
DockAsTabbedDoc(FTab);
RichEdit1 := TAdvRichEditor.Create(FTab);
RichEdit1.Parent := FTab;
RichEdit1.Align := alClient;
RichEdit1.font.Color := clWindow;
RichEdit1.font.Size := 12;
RichEdit1.font.Name := 'Courier New';
RichEdit1.Color := clBlack;
RichEdit1.OnKeyPress := RichEdit1KeyPress;
RichEdit1.OnKeyUP := RichEdit1KeyUp;
RichEdit1.OnMouseDown := RichEdit1MouseDown;
RichEdit1.OnMouseUp := RichEdit1MouseUp;
RichEdit1.OnContextPopup := RichEdit1ContextPopup;
RichEdit1.WantTab := True;
He probado los siguientes códigos y de ninguna forma me muestra los mensajes.
Código Delphi
[-]procedure TConexion.RichEdit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var
msg: TMsg;
begin
if Key = VK_TAB then
begin
ShowMessage('HOLAAA');
beep(0, 100);
while PeekMessage(msg, RichEdit1.handle, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) do;
end;
end;
En este código siguiente me funcionan todas las teclas excepto la #9,, que se supone que es la tecla TAB
Código Delphi
[-]procedure TConexion.RichEdit1KeyPress(Sender: TObject; var Key: Char);
var
AKey: Char;
Comando: string;
begin
AKey := Key;
Key := #0;
if AKey = #9 then
begin
ShowMessage('weeeeee');
beep(10, 10);
Key := #0;
end;
if AKey = #8 then
begin
if Length(Command) > 0 then
begin
Delete(Command, Length(Command), 1);
Delete(ConsoleData, Length(ConsoleData), 1);
ParseTextIntoMEMO(ConsoleData, RichEdit1);
end
else
Key := #0;
end
else if AKey = #13 then
begin
Key := #0;
if Command = 'clear' then
begin
RichEdit1.Clear;
ConsoleData := '';
end;
Command := Command + AKey;
ScSSHShell1.WriteString(Command);
ParseTextIntoMEMO(ConsoleData, RichEdit1);
end
else
begin
Key := #0;
Command := Command + AKey;
ConsoleData := ConsoleData + AKey;
ParseTextIntoMEMO(ConsoleData, RichEdit1);
end;
end;
Disculpad si el código no está muy pulido, aún estoy en prácticas y es la primera vez que utilizo delphi y pascal :(:(.
Si necesitáis algún dato más me lo decís y os lo comparto.