From 80cd1427db1111010d6702ebe437e42194db15cb Mon Sep 17 00:00:00 2001 From: graemeg Date: Tue, 24 Jun 2008 14:59:07 +0000 Subject: * 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. --- src/gui/gui_combobox.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gui') 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; -- cgit v1.2.3-70-g09d2