summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-07-14 16:46:46 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-07-14 16:46:46 +0000
commit9432daf804c88f04f20f89773fd0efdcbe89e360 (patch)
tree59039315145732b1dd965994a5b8f29ba7a07db3
parentccbce7ba60305b5438c3ac6311d39374ee2a0e55 (diff)
downloadfpGUI-9432daf804c88f04f20f89773fd0efdcbe89e360.tar.xz
* Applied some of the various patch from Jean-Marc.
-rw-r--r--prototypes/fpgui2/tests/edittest.lpi2
-rw-r--r--src/corelib/gfx_widget.pas4
-rw-r--r--src/gui/gui_edit.pas6
-rw-r--r--src/gui/gui_editcombo.pas15
4 files changed, 16 insertions, 11 deletions
diff --git a/prototypes/fpgui2/tests/edittest.lpi b/prototypes/fpgui2/tests/edittest.lpi
index 9a7edd84..fa79a0d7 100644
--- a/prototypes/fpgui2/tests/edittest.lpi
+++ b/prototypes/fpgui2/tests/edittest.lpi
@@ -28,7 +28,7 @@
</RunParams>
<RequiredPackages Count="1">
<Item1>
- <PackageName Value="fpgui_package"/>
+ <PackageName Value="fpgui_toolkit"/>
</Item1>
</RequiredPackages>
<Units Count="2">
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index a477c4c5..eb5577d5 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -656,7 +656,7 @@ var
wg: TfpgWidget;
dir: integer;
begin
- if Assigned(OnKeyPress) then
+ if Assigned(OnKeyPress) and FFocusable then
OnKeyPress(self, keycode, shiftstate, consumed);
if consumed then
@@ -739,7 +739,7 @@ procedure TfpgWidget.HandleSetFocus;
var
awg: TfpgWidget;
begin
- if not FFocused then
+ if not FFocused and FFocusable then
begin
FFocused := True;
RePaint;
diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas
index 4be59540..19281258 100644
--- a/src/gui/gui_edit.pas
+++ b/src/gui/gui_edit.pas
@@ -339,7 +339,7 @@ begin
Result.Top := y;
Result.Width := w;
Result.ShowThousand:= AShowThousand;
-// Result.Decimals := ADecimals;
+ Result.Decimals := ADecimals;
if h < TfpgEditFloat(Result).FFont.Height + 6 then
Result.Height:= TfpgEditFloat(Result).FFont.Height + 6
else
@@ -1752,10 +1752,10 @@ begin
fText := fText + DecimalSeparator;
if UTF8Length(fText)-Pos(DecimalSeparator, fText) < fDecimals then
while UTF8Length(fText)-Pos(DecimalSeparator, fText) < fDecimals do
- begin
+ begin
fText := fText + '0';
Inc(FCursorPos);
- end;
+ end;
end;
end;
inherited HandleKeyPress(keycode,shiftstate,consumed);
diff --git a/src/gui/gui_editcombo.pas b/src/gui/gui_editcombo.pas
index 96d2188f..36c87633 100644
--- a/src/gui/gui_editcombo.pas
+++ b/src/gui/gui_editcombo.pas
@@ -129,8 +129,8 @@ type
end;
-function CreateEditCombo(AOwner: TComponent; x, y, w: TfpgCoord; AList:TStringList;
- h: TfpgCoord = 0): TfpgEditCombo;
+function CreateEditCombo(AOwner: TComponent; x, y, w: TfpgCoord; AList:TStringList; ACompletion: boolean = False;
+ ANew: TAllowNew = anNo; h: TfpgCoord = 0): TfpgEditCombo;
implementation
@@ -225,14 +225,16 @@ begin
ListBox.PopupFrame := True;
end;
-function CreateEditCombo(AOwner: TComponent; x, y, w: TfpgCoord; AList: TStringList;
- h: TfpgCoord = 0): TfpgEditCombo;
+function CreateEditCombo(AOwner: TComponent; x, y, w: TfpgCoord; AList:TStringList; ACompletion: boolean = False;
+ ANew: TAllowNew = anNo; h: TfpgCoord = 0): TfpgEditCombo;
begin
Result := TfpgEditCombo.Create(AOwner);
Result.Left := x;
Result.Top := y;
Result.Width := w;
Result.Focusable := True;
+ Result.AutoCompletion := ACompletion;
+ Result.AllowNew := ANew;
if h < TfpgEditCombo(Result).Font.Height + 6 then
Result.Height:= TfpgEditCombo(Result).Font.Height + 6
else
@@ -528,7 +530,10 @@ begin
FItems.Add(FText);
anAsk:
if TfpgMessageDialog.Question(rsNewItemDetected, Format(rsAddNewItem, [FText])) = mbYes then
- FItems.Add(FText)
+ begin
+ FItems.Add(FText);
+ FocusItem := Pred(FItems.Count);
+ end
else
begin
FNewItem:= False;