summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-27 12:57:16 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-27 12:57:16 +0000
commit316a16c5f3337ad23ecdfdd6444c0b72af3f2406 (patch)
treea4209a054dc20164758f01c619533b09ca120acc /src/gui
parent4fd4e5cc02054005ce8a9aae976350aefc54a94e (diff)
downloadfpGUI-316a16c5f3337ad23ecdfdd6444c0b72af3f2406.tar.xz
* Implemented List Mediators with tiOPF support and added a demo.
* Added a quick workaround for the InvertCaret function causing a AV. * MenuBar now keeps the current menu focused even if you open more than 2 levels deep of Popup Menus. * Added some TODO entries to Widgets. Also published some missing properties. * Fixed repainting issue with TfpgComobBox when you set the Width from code and made the component focusable. Not sure why it wasn't! * Updated Lazarus IDE code template for new fpGUI applications.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui_combobox.pas32
-rw-r--r--src/gui/gui_listbox.pas2
-rw-r--r--src/gui/gui_menu.pas4
3 files changed, 36 insertions, 2 deletions
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index bcf3de8a..a7b9f9c7 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -2,6 +2,16 @@ unit gui_combobox;
{$mode objfpc}{$H+}
+{
+ TODO:
+ * When combobox Items changes, the combobox needs to refresh. We need a
+ custom StringItems class to notify us of changes. See TfpgListBox for
+ an example.
+ * Implement .BeginUpdate and .EndUpdate methods so we know when to refresh
+ the items list.
+
+}
+
interface
uses
@@ -37,6 +47,7 @@ type
procedure SetFocusItem(const AValue: integer);
procedure SetFontDesc(const AValue: string);
procedure SetText(const AValue: string);
+ procedure SetWidth(const AValue: TfpgCoord);
protected
FMargin: integer;
procedure SetEnabled(const AValue: boolean); override;
@@ -52,8 +63,10 @@ type
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
+ procedure Update;
procedure AfterConstruction; override;
property Font: TfpgFont read FFont;
+ property Width: TfpgCoord read FWidth write SetWidth;
end;
@@ -65,6 +78,8 @@ type
property FontDesc;
property Items;
property Text;
+ property Width;
+ property Height;
property OnChange;
end;
@@ -299,6 +314,16 @@ begin
end;
end;
+procedure TfpgCustomComboBox.SetWidth(const AValue: TfpgCoord);
+begin
+ if FWidth = AValue then
+ Exit; //==>
+ FWidth := AValue;
+ if Assigned(FInternalBtn) then
+ FInternalBtn.Left := Width - 20;
+ RePaint;
+end;
+
procedure TfpgCustomComboBox.SetEnabled(const AValue: boolean);
begin
inherited SetEnabled(AValue);
@@ -369,6 +394,7 @@ begin
FHeight := 23;
FFocusItem := 0; // nothing is selected
FMargin := 3;
+ FFocusable := True;
FFont := fpgGetFont('#List');
FItems := TStringList.Create;
@@ -382,6 +408,12 @@ begin
inherited Destroy;
end;
+procedure TfpgCustomComboBox.Update;
+begin
+ FFocusItem := 1;
+ Repaint;
+end;
+
procedure TfpgCustomComboBox.AfterConstruction;
begin
inherited AfterConstruction;
diff --git a/src/gui/gui_listbox.pas b/src/gui/gui_listbox.pas
index 0933c211..d565c7c8 100644
--- a/src/gui/gui_listbox.pas
+++ b/src/gui/gui_listbox.pas
@@ -6,6 +6,8 @@ unit gui_listbox;
TODO:
* Refactor these to have a better hierarchy
* Only surface properties as published in TfpgListBox
+ * Implement .BeginUpdate and .EndUpdate methods so we know when to refresh
+ the items list.
}
interface
diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas
index 60c3bc12..c34d40a9 100644
--- a/src/gui/gui_menu.pas
+++ b/src/gui/gui_menu.pas
@@ -632,8 +632,8 @@ begin
VisibleItem(FFocusItem).Click;
end; { if/else }
- if OpenerMenuBar <> nil then
- OpenerMenuBar.DeActivateMenu;
+// if OpenerMenuBar <> nil then
+// OpenerMenuBar.DeActivateMenu;
end;
procedure TfpgPopupMenu.CloseSubmenus;