summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-19 11:04:42 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-19 11:04:42 +0000
commitf169a6e98f3866cf39a4463ea1815abb72b84301 (patch)
tree464fac60add771db396453e0dcfac2b890ca0289
parent790b38ec8407f47b24962d8ebb72fde9f0b28a39 (diff)
downloadfpGUI-f169a6e98f3866cf39a4463ea1815abb72b84301.tar.xz
* Finally I seem to have solved the mystery of the ComboBox that refuses to close. And what a silly bug it was.
* Applied a minor fix to CalenderCombo so it behaves like the normal ComboBox.
-rw-r--r--src/corelib/gfx_popupwindow.pas1
-rw-r--r--src/corelib/x11/gfx_x11.pas16
-rw-r--r--src/gui/gui_combobox.pas26
-rw-r--r--src/gui/gui_popupcalendar.pas1
4 files changed, 12 insertions, 32 deletions
diff --git a/src/corelib/gfx_popupwindow.pas b/src/corelib/gfx_popupwindow.pas
index def8e47c..33921bc9 100644
--- a/src/corelib/gfx_popupwindow.pas
+++ b/src/corelib/gfx_popupwindow.pas
@@ -280,7 +280,6 @@ var
pt: TPoint;
begin
PopupListAdd(self);
- DontCloseWidget := nil;
// translate coordinates
pt := WindowToScreen(AWidget, Point(x, y));
// reposition
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas
index b693b3ce..adc1df8f 100644
--- a/src/corelib/x11/gfx_x11.pas
+++ b/src/corelib/x11/gfx_x11.pas
@@ -923,21 +923,6 @@ begin
if not Assigned(w) then
ReportLostWindow(ev);
-{ else
- begin
- if ev._type = X.ButtonPress then
- begin
- writeln('***** CaptureMouse for ', w.ClassName, ' - ', w.Name);
- w.CaptureMouse;
- end
- else
- begin
- writeln('***** ReleaseMouse for ', w.ClassName, ' - ', w.Name);
- w.ReleaseMouse;
- end;
- end;
-}
-
{ This closes popup windows when you click the mouse elsewhere }
if ev._type = X.ButtonPress then
begin
@@ -951,7 +936,6 @@ begin
(not PopupDontCloseWidget(TfpgWidget(ew))) then
begin
ClosePopups;
-// fpgPostMessage(nil, ew, FPGM_POPUPCLOSE);
end;
end;
end;
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index 5a1cf94e..392daacb 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -92,7 +92,6 @@ type
procedure InternalBtnClick(Sender: TObject);
procedure SetFocusItem(const AValue: integer);
procedure CalculateInternalButtonRect;
- procedure MsgPopupClose(var msg: TfpgMessageRec); message FPGM_POPUPCLOSE;
protected
FMargin: integer;
FBtnPressed: Boolean;
@@ -384,9 +383,14 @@ var
rowcount: integer;
r: TfpgRect;
begin
- writeln('DoDropDown');
+ {$IFDEF DEBUG}
+ write('DoDropDown');
+ {$ENDIF}
if (not Assigned(FDropDown)) or (not FDropDown.HasHandle) then
begin
+ {$IFDEF DEBUG}
+ writeln('.... creating');
+ {$ENDIF}
FreeAndNil(FDropDown);
OriginalFocusRoot := FocusRootWidget;
@@ -403,12 +407,15 @@ begin
ddw.Width := Width;
ddw.Height := (ddw.ListBox.RowHeight * rowcount) + 4;
ddw.DontCloseWidget := self; // now we can control when the popup window closes
- r := GetDropDownPos(Parent, self, ddw);
- ddw.Height := r.Height;
+ r := GetDropDownPos(Parent, self, ddw); // find suitable position
+ ddw.Height := r.Height; // in case GetDropDownPos resized us
ddw.ShowAt(Parent, r.Left, r.Top);
end
else
begin
+ {$IFDEF DEBUG}
+ writeln('.... destroying');
+ {$ENDIF}
// This actually never gets reached!!! Debug and test if this is still needed.
FBtnPressed := False;
ddw := TComboboxDropdownWindow(FDropDown);
@@ -467,17 +474,6 @@ begin
FInternalBtnRect.SetRect(Width - Min(Height, 20), 2, Min(Height, 20)-2, Height-4);
end;
-procedure TfpgAbstractComboBox.MsgPopupClose(var msg: TfpgMessageRec);
-begin
- { TODO : Fix Combobox dropdown flicker effect. }
- { This gets called on MouseUp after you clicked on the combobox to open it.
- The GFX backend is programmed to close popups, so this DoDropDown call
- reopens it again.
- This is what causes the flicker effect when the dropdown window is
- displayed - it actually gets created, destroyed and then created again.}
- DoDropDown;
-end;
-
procedure TfpgAbstractComboBox.SetHeight(const AValue: TfpgCoord);
begin
inherited;
diff --git a/src/gui/gui_popupcalendar.pas b/src/gui/gui_popupcalendar.pas
index d2129ce8..a70d5a6f 100644
--- a/src/gui/gui_popupcalendar.pas
+++ b/src/gui/gui_popupcalendar.pas
@@ -768,6 +768,7 @@ begin
begin
FDropDown := TfpgPopupCalendar.Create(nil, FocusRootWidget);
ddw := TfpgPopupCalendar(FDropDown);
+ ddw.DontCloseWidget := self;
{ Set to false CloseOnSelect to leave opened popup calendar menu}
ddw.CloseOnSelect := CloseOnSelect;
ddw.CallerWidget := self;