Browse Source

Small improvements in bckeyboard.pas

lainz 9 years ago
parent
commit
4927aa7830
3 changed files with 37 additions and 8 deletions
  1. 16 0
      bckeyboard.pas
  2. 15 3
      test/test_bckeyboard/umain.lfm
  3. 6 5
      test/test_bckeyboard/umain.pas

+ 16 - 0
bckeyboard.pas

@@ -19,12 +19,14 @@ type
     FButton: TBCButton;
     FOnUserChange: TNotifyEvent;
     FPanel, FRow1, FRow2, FRow3, FRow4: TBCPanel;
+    FPanelsColor: TColor;
     F_q, F_w, F_e, F_r, F_t, F_y, F_u, F_i, F_o, F_p, F_a, F_s, F_d,
     F_f, F_g, F_h, F_j, F_k, F_l, F_z, F_x, F_c, F_v, F_b, F_n, F_m,
     F_shift, F_space, F_back: TBCButton;
     FVisible: boolean;
     procedure SetFButton(AValue: TBCButton);
     procedure SetFPanel(AValue: TBCPanel);
+    procedure SetFPanelsColor(AValue: TColor);
     procedure SetFThemeManager(AValue: TBCThemeManager);
   protected
     procedure PressVirtKey(p: longint);
@@ -47,6 +49,8 @@ type
   public
     { The real panel that's used as container for all the numeric buttons }
     property Panel: TBCPanel read FPanel write SetFPanel;
+    { The color of all the panels involved in the control }
+    property PanelsColor: TColor read FPanelsColor write SetFPanelsColor;
     { A fake button that's used as style base for all the numeric buttons }
     property ButtonStyle: TBCButton read FButton write SetFButton;
     { If it's visible or not }
@@ -472,4 +476,16 @@ begin
   FPanel := AValue;
 end;
 
+procedure TBCKeyboard.SetFPanelsColor(AValue: TColor);
+begin
+  if FPanelsColor = AValue then
+    Exit;
+  FPanelsColor := AValue;
+  FPanel.Background.Color := AValue;
+  FRow1.Background.Color := AValue;
+  FRow2.Background.Color := AValue;
+  FRow3.Background.Color := AValue;
+  FRow4.Background.Color := AValue;
+end;
+
 end.

+ 15 - 3
test/test_bckeyboard/umain.lfm

@@ -8,13 +8,25 @@ object Form1: TForm1
   ClientWidth = 320
   OnShow = FormShow
   LCLVersion = '1.7'
-  object Edit1: TEdit
+  object BCDPanel1: TBCDPanel
     Left = 0
-    Height = 28
+    Height = 240
     Top = 0
     Width = 320
-    Align = alTop
+    Align = alClient
+    Alignment = taLeftJustify
+    Caption = 'BCDPanel1'
+    ClientHeight = 240
+    ClientWidth = 320
     TabOrder = 0
+    object Edit1: TBCDEdit
+      Left = 1
+      Height = 28
+      Top = 1
+      Width = 318
+      Align = alTop
+      DrawStyle = dsDefault
+    end
   end
   object BCKeyboard1: TBCKeyboard
     ThemeManager = BCDefaultThemeManager1

+ 6 - 5
test/test_bckeyboard/umain.pas

@@ -5,8 +5,7 @@ unit umain;
 interface
 
 uses
-  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  BCKeyboard, BCDefaultThemeManager;
+  Forms, BCKeyboard, BCDefaultThemeManager, BGRACustomDrawn;
 
 type
 
@@ -14,8 +13,9 @@ type
 
   TForm1 = class(TForm)
     BCDefaultThemeManager1: TBCDefaultThemeManager;
+    BCDPanel1: TBCDPanel;
     BCKeyboard1: TBCKeyboard;
-    Edit1: TEdit;
+    Edit1: TBCDEdit;
     procedure FormShow(Sender: TObject);
   private
 
@@ -35,8 +35,9 @@ implementation
 procedure TForm1.FormShow(Sender: TObject);
 begin
   BCDefaultThemeManager1.Apply();
-  BCKeyboard1.Panel.Left:=0;
-  BCKeyboard1.Panel.Top:=Edit1.Height;
+  BCKeyboard1.PanelsColor := $00535353;
+  BCKeyboard1.Panel.Left := 0;
+  BCKeyboard1.Panel.Top := Edit1.Height + 2;
   BCKeyboard1.Show();
   Form1.Width := BCKeyboard1.Panel.Width;
 end;