[lazarus] Combobox patch

olivier GUILBAUD golivier at free.fr
Tue Oct 7 17:38:44 EDT 2003


Hi

I have implemented the control of style csDropDownList for the 
TCustomComboBox. 

Thanks

Olivier

? .directory
Index: lcl/stdctrls.pp
===================================================================
RCS file: /FPC/CVS/projects/lazarus/lcl/stdctrls.pp,v
retrieving revision 1.107
diff -u -r1.107 stdctrls.pp
--- lcl/stdctrls.pp	26 Sep 2003 18:19:40 -0000	1.107
+++ lcl/stdctrls.pp	7 Oct 2003 21:38:48 -0000
@@ -1,4 +1,4 @@
-{ 
+{
  /*************************************************************************** 
                                stdctrls.pp
                                -----------
@@ -247,7 +247,8 @@
     procedure SetSorted(Val : boolean); virtual;
     procedure SetStyle(Val : TComboBoxStyle); virtual;
     procedure KeyDown(var Key : Word; Shift : TShiftState); override;
-
+    procedure KeyPress(var Key : Char); override;
+    
     property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
     property Items: TStrings read FItems write SetItems;
     property ItemHeight: Integer read GetItemHeight write SetItemHeight;
Index: lcl/include/customcombobox.inc
===================================================================
RCS file: /FPC/CVS/projects/lazarus/lcl/include/customcombobox.inc,v
retrieving revision 1.32
diff -u -r1.32 customcombobox.inc
--- lcl/include/customcombobox.inc	20 Sep 2003 13:27:49 -0000	1.32
+++ lcl/include/customcombobox.inc	7 Oct 2003 21:38:51 -0000
@@ -416,6 +416,15 @@
     inherited KeyDown(Key, Shift);
 end;
 
+procedure TCustomComboBox.KeyPress(var Key : Char);
+begin
+  if (Style=csDropDownList) and (Ord(Key)>31) then
+    Key:=#0
+  else
+    Inherited KeyPress(Key);
+end;
+
+
 {------------------------------------------------------------------------------
   function TCustomComboBox.SelectItem(const AnItem: String): Boolean;
 





More information about the Lazarus mailing list