diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/gdi/gfx_gdi.pas | 4 | ||||
-rw-r--r-- | src/gui/gui_combobox.pas | 10 | ||||
-rw-r--r-- | src/gui/gui_listbox.pas | 9 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index bb89c8d2..e0f44349 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -533,7 +533,9 @@ begin pw := mw; while (pw <> nil) and (pw.Parent <> nil) do pw := TfpgWindowImpl(pw.Parent); - if ((pw = nil) or (PopupListFind(pw.WinHandle) = nil)) and (not PopupDontCloseWidget(TfpgWidget(mw))) and + + if ((pw = nil) or (PopupListFind(pw.WinHandle) = nil)) and + (not PopupDontCloseWidget(TfpgWidget(mw))) and ((uMsg = WM_LBUTTONDOWN) or (uMsg = WM_LBUTTONUP)) then begin ClosePopups; diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas index cfe2c966..b313db5f 100644 --- a/src/gui/gui_combobox.pas +++ b/src/gui/gui_combobox.pas @@ -126,6 +126,7 @@ type procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override; procedure HandleShow; override; procedure HandleHide; override; + procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -181,6 +182,13 @@ begin FocusRootWidget.SetFocus; end; +procedure TDropDownWindow.HandleLMouseUp(x, y: integer; shiftstate: TShiftState + ); +begin + writeln('TDropDownWindow.HandleLMouseUp'); + inherited HandleLMouseUp(x, y, shiftstate); +end; + constructor TDropDownWindow.Create(AOwner: TComponent); begin inherited Create(AOwner); @@ -274,7 +282,7 @@ begin ddw.ListBox.Items.Assign(FItems); ddw.ListBox.FocusItem := FFocusItem; -// ddw.DontCloseWidget := self; // now we can control when the popup window closes + ddw.DontCloseWidget := self; // now we can control when the popup window closes ddw.ShowAt(Parent, Left, Top+Height); ddw.ListBox.SetFocus; end diff --git a/src/gui/gui_listbox.pas b/src/gui/gui_listbox.pas index 4e2a2f39..9b141ed7 100644 --- a/src/gui/gui_listbox.pas +++ b/src/gui/gui_listbox.pas @@ -412,15 +412,18 @@ begin end; procedure TfpgBaseListBox.HandleLMouseUp(x, y: integer; shiftstate: TShiftState); +var + r: TfpgRect; begin + r.SetRect(Left, Top, Width, Height); inherited HandleLMouseUp(x, y, shiftstate); if ItemCount < 1 then Exit; //==> - + FMouseDragging := False; { User clicked outside listbox bounds. ComboBox requires this check. } - if not (y < 0) then + if PtInRect(r, Point(x, y)) then begin FFocusItem := FFirstItem + Trunc((y - FMargin) / RowHeight); if FFocusItem > ItemCount then @@ -651,6 +654,8 @@ end; procedure TfpgTextListBox.DrawItem(num: integer; rect: TfpgRect; flags: integer); begin + if num < 1 then + Exit; fpgStyle.DrawString(Canvas, rect.left+2, rect.top+1, FItems.Strings[num-1], Enabled); end; |