Ver Mensaje Individual
  #9  
Antiguo 12-08-2005
Avatar de Sr.Scorpion
Sr.Scorpion Sr.Scorpion is offline
Miembro
 
Registrado: mar 2005
Posts: 92
Reputación: 20
Sr.Scorpion Va por buen camino
Talking

Bueno al final tuve que hacer dos procedimientos... uno para el estado de las teclas y otro para cuando se presionan. En el evento OnShow de la Forma principal llamo al procedimiento KeyState.. el cual se ejecuta solamente una vez.

Código:
 
procedure TMain.KeyState();
begin
If GetKeyState(VK_NUMLOCK) = 1 Then
 StatusBar.Panels[2].Style:= psText
else
 StatusBar.Panels[2].Style:= psOwnerDraw;
If GetKeyState(VK_CAPITAL) = 1 Then
 StatusBar.Panels[3].Style:= psText
else
 StatusBar.Panels[3].Style:= psOwnerDraw;
If GetKeyState(VK_SCROLL) = 1 Then
 StatusBar.Panels[4].Style:= psText
else
 StatusBar.Panels[4].Style:= psOwnerDraw;
end;
y el otro procedimiento es KeyPressed que lo llamo solamente en el OnKeyDown y se le pasa como parametro la variable Key del OnKeyDown

Código:
 
procedure TMain.KeyPressed(Key: DWORD);
begin
If Key = VK_NUMLOCK then
 if (GetKeyState(VK_NUMLOCK) + 127) = 0 Then
   StatusBar.Panels[2].Style:= psText
  else
   StatusBar.Panels[2].Style:= psOwnerDraw;
If Key = VK_CAPITAL then
 if (GetKeyState(VK_CAPITAL) + 127) = 0 Then
   StatusBar.Panels[3].Style:= psText
  else
   StatusBar.Panels[3].Style:= psOwnerDraw;
If Key = VK_SCROLL then
 if (GetKeyState(VK_SCROLL) + 127) = 0 Then
   StatusBar.Panels[4].Style:= psText
  else
   StatusBar.Panels[4].Style:= psOwnerDraw;
end;
Si pueden mejorarlo pues bienvenido sea.... esto por lo menos soluciona el problema.
__________________
La paciencia es un árbol de raíz amarga pero de frutos muy dulces.

Sr.Scorpion
Responder Con Cita