home *** CD-ROM | disk | FTP | other *** search
/ TopWare 18: Liquid / Image.iso / liquid / top1143 / gepackt.exe / BSPQTSW.EXE / STATUSB.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-06-28  |  4.1 KB  |  155 lines

  1. (***************************************
  2. * WG-VISION 1.0   BEISPIELPROGRAMM     *
  3. ****************************************
  4. *                                      *
  5. * Anzeige des Tastaturstatus in der    *
  6. * Statuszeile des Desktop              *
  7. *                                      *
  8. ****************************************
  9. * (c) 1993 Dipl.Phys. Mathias Scholz   *
  10. ***************************************)
  11.  
  12. {$I COMPILER.INC}
  13.  
  14. program StatusB;
  15.  
  16. uses WApp,
  17.      WDecl,
  18.      WDlg,
  19.      WDriver,
  20.      WUtils,
  21.      WEvent,
  22.      Graph;
  23.  
  24.  
  25. const cmNewWindow   = 103;
  26.  
  27. type TApplication=object(TApp)
  28.       procedure InitMenuBar; virtual;
  29.       procedure HandleEvent; virtual;
  30.       procedure StatusBar; virtual;
  31.       procedure NewWindow;
  32.      end;
  33.  
  34. var MyApp:TApplication;
  35.  
  36.  
  37. {Implementation TApplication}
  38.  
  39. procedure TApplication.InitMenuBar;
  40. begin
  41.   MainMenu('~F~enster',0);
  42.    SubMenu('~F~enster aufblenden',cmNewWindow,0,0,false,false);
  43.    SubMenu('E~x~it  Alt-X',cmCloseApplication,0,altX,false,false);
  44. end;
  45.  
  46. procedure TApplication.HandleEvent;
  47. var I:integer;
  48.  
  49. procedure HandleStatusBar;
  50. begin
  51.    if Keyb.CapsLock and (GetPixel(254,GetMaxY-16)=LightGray) then
  52.     begin
  53.       Mouse.HideMouse;
  54.       FBar(250,GetMaxY-18,258,GetMaxY-12,LightCyan);
  55.       Mouse.ShowMouse;
  56.     end;
  57.    if not (Keyb.CapsLock) and (GetPixel(254,GetMaxY-16)=LightCyan) then
  58.     begin
  59.       Mouse.HideMouse;
  60.       FBar(250,GetMaxY-18,258,GetMaxY-12,LightGray);
  61.       Mouse.ShowMouse;
  62.     end;
  63.    if Keyb.NumLock and (GetPixel(350,GetMaxY-16)=LightGray) then
  64.     begin
  65.       Mouse.HideMouse;
  66.       FBar(346,GetMaxY-18,354,GetMaxY-12,LightCyan);
  67.       Mouse.ShowMouse;
  68.     end;
  69.    if not (Keyb.NumLock) and (GetPixel(350,GetMaxY-16)=LightCyan) then
  70.     begin
  71.       Mouse.HideMouse;
  72.       FBar(346,GetMaxY-18,354,GetMaxY-12,LightGray);
  73.       Mouse.ShowMouse;
  74.     end;
  75.    if Keyb.ScrollLock and (GetPixel(470,GetMaxY-16)=LightGray) then
  76.     begin
  77.       Mouse.HideMouse;
  78.       FBar(466,GetMaxY-18,474,GetMaxY-12,LightCyan);
  79.       Mouse.ShowMouse;
  80.     end;
  81.    if not (Keyb.ScrollLock) and (GetPixel(470,GetMaxY-16)=LightCyan) then
  82.     begin
  83.       Mouse.HideMouse;
  84.       FBar(466,GetMaxY-18,474,GetMaxY-12,LightGray);
  85.       Mouse.ShowMouse;
  86.     end;
  87.    if Keyb.LShiftKey and (GetPixel(547,GetMaxY-16)=LightGray) then
  88.     begin
  89.       Mouse.HideMouse;
  90.       FBar(544,GetMaxY-18,551,GetMaxY-12,LightCyan);
  91.       Mouse.ShowMouse;
  92.     end;
  93.    if not (Keyb.LShiftKey) and (GetPixel(547,GetMaxY-16)=LightCyan) then
  94.     begin
  95.       Mouse.HideMouse;
  96.       FBar(544,GetMaxY-18,551,GetMaxY-12,LightGray);
  97.       Mouse.ShowMouse;
  98.     end;
  99.    if Keyb.RShiftKey and (GetPixel(561,GetMaxY-16)=LightGray) then
  100.     begin
  101.       Mouse.HideMouse;
  102.       FBar(559,GetMaxY-18,566,GetMaxY-12,LightCyan);
  103.       Mouse.ShowMouse;
  104.     end;
  105.    if not (Keyb.RShiftKey) and (GetPixel(561,GetMaxY-16)=LightCyan) then
  106.     begin
  107.       Mouse.HideMouse;
  108.       FBar(559,GetMaxY-18,566,GetMaxY-12,LightGray);
  109.       Mouse.ShowMouse;
  110.     end;
  111. end;
  112.  
  113. {------}
  114.  
  115. begin
  116.   TProgram.HandleEvent;
  117.   HandleStatusBar;
  118.   case Event.Command of
  119.    cmNewWindow   : NewWindow;
  120.   end; {case}
  121. end;
  122.  
  123. procedure TApplication.NewWindow;
  124. var R:TRect;
  125.     Window:PWindow;
  126. begin
  127.   R.Assign(60,80,440,280);
  128.   Window:=New(PWindow, Init(R,'Beispiel',winDouble+winPanel+winMenu+winKey));
  129.   InsertDesktop(Window);
  130. end;
  131.  
  132. procedure TApplication.StatusBar;
  133. var I:integer;
  134. begin
  135.   FBar(4,GetMaxY-26,GetMaxX-4,GetMaxY-4,LightGray);
  136.   D3Frame(6,GetMaxY-24,GetMaxX-6,GetMaxY-6,Black,White);
  137.   SetColor(Red);
  138.   OutTextXY(15,GetMaxY-18,'Tataturstatus');
  139.   SetColor(Black);
  140.   OutTextXY(15,GetMaxY-18,'                   Caps Lock    Num Lock    Scroll Lock     Shift');
  141.   D3Frame(249,GetMaxY-19,259,GetMaxY-11,Black,White);
  142.   D3Frame(345,GetMaxY-19,355,GetMaxY-11,Black,White);
  143.   D3Frame(465,GetMaxY-19,475,GetMaxY-11,Black,White);
  144.   D3Frame(543,GetMaxY-19,552,GetMaxY-11,Black,White);
  145.   D3Frame(558,GetMaxY-19,567,GetMaxY-11,Black,White);
  146. end;
  147.  
  148. {Hauptprogramm}
  149.  
  150. begin
  151.   MyApp.Init('Statusbar mit Tastaturstatusanzeige');
  152.   MyApp.Run;
  153.   MyApp.Done;
  154. end.
  155.