diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-06-24 14:59:07 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-06-24 14:59:07 +0000 |
commit | 80cd1427db1111010d6702ebe437e42194db15cb (patch) | |
tree | 2a77c637f84d25de9fa5a25c63cb7eb7c5b29b74 /src/gui | |
parent | d3899e742e2a205b2e6138384eef731c46401ed5 (diff) | |
download | fpGUI-80cd1427db1111010d6702ebe437e42194db15cb.tar.xz |
* Using Assign() to set Items of TfpgComboBox did not update the displayed text.
* Added a new option to the TfpgBaseComboBox.Options called wo_AllowUserBlank. By default a user cannot use Up arrow to reset/blank the ComboBox to FocusItem = -1. You now have to add wo_AllowUserBlank in the Options to enable that.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui_combobox.pas | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas index 31dc8989..6840882e 100644 --- a/src/gui/gui_combobox.pas +++ b/src/gui/gui_combobox.pas @@ -57,7 +57,7 @@ uses type // widget options - TfpgComboOption = (wo_FocusItemTriggersOnChange); + TfpgComboOption = (wo_FocusItemTriggersOnChange, wo_AllowUserBlank); TfpgComboOptions = set of TfpgComboOption; @@ -236,6 +236,7 @@ procedure TfpgBaseComboBox.InternalItemsChanged(Sender: TObject); begin if FItems.Count = 0 then FocusItem := -1; + Repaint; end; procedure TfpgBaseComboBox.HandleKeyPress(var keycode: word; @@ -263,7 +264,10 @@ begin keyUp: begin - FocusItem := FocusItem - 1; + if (FocusItem = 0) and (wo_AllowUserBlank in FOptions) then + FocusItem := FocusItem - 1 + else if FocusItem > 0 then + FocusItem := FocusItem - 1; if old <> FocusItem then DoOnChange; consumed := True; |