diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-02-18 14:56:38 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-02-18 14:56:38 +0000 |
commit | caa8b667cca6e32c52466422ee14c689f35038b4 (patch) | |
tree | 3c31dcff7f1c3be545ecb1bd531415e85e31e7a5 | |
parent | 80edb8c64ec1ce85e4ffdd90c9302ea4bd97855b (diff) | |
download | fpGUI-caa8b667cca6e32c52466422ee14c689f35038b4.tar.xz |
* I think I fixed the issue with PopupWindows taking focus
under Windows.
* I think I fixed the click selection issues in ComboBoxes.
* Also I believe the Calendar component now works under Windows.
* Menuse should now works correctly. All the above tested on Win2k.
* Due to the above changes I had to modify resizer component in
the UI Designer. There is still one minor issue, but that should
be fixed soon.
-rw-r--r-- | examples/apps/uidesigner/uidesigner.lpi | 9 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdresizer.pas | 2 | ||||
-rw-r--r-- | examples/gui/calendar/calendartest.lpi | 9 | ||||
-rw-r--r-- | prototypes/fpgui2/tests/edittest.lpi | 9 | ||||
-rw-r--r-- | src/corelib/gdi/gfx_gdi.pas | 34 | ||||
-rw-r--r-- | src/corelib/gfx_popupwindow.pas | 19 | ||||
-rw-r--r-- | src/gui/gui_combobox.pas | 7 | ||||
-rw-r--r-- | src/gui/gui_menu.pas | 22 |
8 files changed, 66 insertions, 45 deletions
diff --git a/examples/apps/uidesigner/uidesigner.lpi b/examples/apps/uidesigner/uidesigner.lpi index 683e219a..cd6e7a2d 100644 --- a/examples/apps/uidesigner/uidesigner.lpi +++ b/examples/apps/uidesigner/uidesigner.lpi @@ -1,15 +1,15 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="6"/> + <PathDelim Value="\"/> + <Version Value="5"/> <General> <Flags> <SaveOnlyProjectUnits Value="True"/> </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <IconPath Value="./"/> + <IconPath Value=".\"/> <TargetFileExt Value=""/> <Title Value="uiDesigner"/> </General> @@ -24,7 +24,7 @@ <RunParams> <local> <FormatVersion Value="1"/> - <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> </local> </RunParams> <RequiredPackages Count="1"> @@ -108,6 +108,7 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> + <PathDelim Value="\"/> <Parsing> <SyntaxOptions> <AllowLabel Value="False"/> diff --git a/examples/apps/uidesigner/vfdresizer.pas b/examples/apps/uidesigner/vfdresizer.pas index 882f43ab..2a53411f 100644 --- a/examples/apps/uidesigner/vfdresizer.pas +++ b/examples/apps/uidesigner/vfdresizer.pas @@ -66,12 +66,14 @@ begin FDragging := True; FDragPosX := x; FDragPosy := y; + CaptureMouse; end; procedure TwgResizer.HandleLMouseUp(x, y: integer; shiftstate: TShiftState); begin inherited HandleLMouseUp(x, y, shiftstate); FDragging := False; + ReleaseMouse; end; procedure TwgResizer.HandleMouseMove(x, y: integer; btnstate: word; diff --git a/examples/gui/calendar/calendartest.lpi b/examples/gui/calendar/calendartest.lpi index 431c61ee..663eb890 100644 --- a/examples/gui/calendar/calendartest.lpi +++ b/examples/gui/calendar/calendartest.lpi @@ -1,15 +1,15 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="6"/> + <PathDelim Value="\"/> + <Version Value="5"/> <General> <Flags> <SaveOnlyProjectUnits Value="True"/> </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <IconPath Value="./"/> + <IconPath Value=".\"/> <TargetFileExt Value=""/> </General> <VersionInfo> @@ -23,7 +23,7 @@ <RunParams> <local> <FormatVersion Value="1"/> - <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> </local> </RunParams> <RequiredPackages Count="1"> @@ -42,6 +42,7 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> + <PathDelim Value="\"/> <CodeGeneration> <Generate Value="Faster"/> </CodeGeneration> diff --git a/prototypes/fpgui2/tests/edittest.lpi b/prototypes/fpgui2/tests/edittest.lpi index 2879bbde..8b8c2d24 100644 --- a/prototypes/fpgui2/tests/edittest.lpi +++ b/prototypes/fpgui2/tests/edittest.lpi @@ -1,15 +1,15 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="6"/> + <PathDelim Value="\"/> + <Version Value="5"/> <General> <Flags> <SaveOnlyProjectUnits Value="True"/> </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <IconPath Value="./"/> + <IconPath Value=".\"/> <TargetFileExt Value=""/> </General> <VersionInfo> @@ -23,7 +23,7 @@ <RunParams> <local> <FormatVersion Value="1"/> - <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> </local> </RunParams> <RequiredPackages Count="1"> @@ -47,6 +47,7 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> + <PathDelim Value="\"/> <CodeGeneration> <Generate Value="Faster"/> </CodeGeneration> diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index e0ab498c..cd926cb0 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -644,8 +644,8 @@ begin writeln('fpGFX/GDI:', w.ClassName + ': MouseButtonDown event'); {$ENDIF} mcode := FPGM_MOUSEDOWN; - if PopupListFirst = nil then - SetCapture(w.WinHandle); +// if PopupListFirst = nil then +// SetCapture(w.WinHandle); end; WM_LBUTTONUP, @@ -656,8 +656,8 @@ begin writeln('fpGFX/GDI:', w.ClassName + ': MouseButtonUp event'); {$ENDIF} mcode := FPGM_MOUSEUP; - if PopupListFirst = nil then - ReleaseCapture; +// if PopupListFirst = nil then +// ReleaseCapture; end; //WM_LBUTTONDBLCLK: //mcode := FPGM_DOUBLECLICK; @@ -799,33 +799,36 @@ begin WM_NCACTIVATE: begin {$IFDEF DEBUG} - write(w.ClassName + ': '); - writeln('WM_NCACTIVATE'); + write(w.ClassName + ': WM_NCACTIVATE'); {$ENDIF} + if (PopupListFirst <> nil) and (PopupListFirst.Visible) then + begin + {$IFDEF DEBUG} + writeln(' Blockmsg = True (part 1) : ' + PopupListFirst.ClassName); + {$ENDIF} + // This is ugly but needed for now to get TfpgCombobox to work +// if PopupListFirst.ClassName <> 'TDropDownWindow' then + if not (PopupListFirst is TfpgPopupWindow) then + blockmsg := True; + end else if (wapplication.TopModalForm <> nil) then begin if (wParam = 0) and (wapplication.TopModalForm = w) then begin {$IFDEF DEBUG} - writeln(' Blockmsg = True (part 1)'); + writeln(' Blockmsg = True (part 2)'); {$ENDIF} blockmsg := True; end else if (wParam <> 0) and (wapplication.TopModalForm <> w) then begin {$IFDEF DEBUG} - writeln(' Blockmsg = True (part 2)'); + writeln(' Blockmsg = True (part 3)'); {$ENDIF} blockmsg := True; end; end; - //if (PopupListFirst <> nil) and (PopupListFirst.Visible) then - //begin - //writeln(' Blockmsg = True (part 3)'); - //blockmsg := True; - //end; - if not blockmsg then Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); end; @@ -1287,6 +1290,9 @@ end; procedure TfpgWindowImpl.ReleaseMouse; begin Windows.ReleaseCapture; +// if PopupListFirst <> nil then +// Windows.SetCapture(PopupListFirst^.); +// if GfxFirstPopup <> nil then SetCapture(GfxFirstPopup^.wg.WinHandle); end; function TfpgWindowImpl.HandleIsValid: boolean; diff --git a/src/corelib/gfx_popupwindow.pas b/src/corelib/gfx_popupwindow.pas index 27a144be..cf75b5da 100644 --- a/src/corelib/gfx_popupwindow.pas +++ b/src/corelib/gfx_popupwindow.pas @@ -42,8 +42,6 @@ type protected procedure MsgClose(var msg: TfpgMessageRec); message FPGM_CLOSE; procedure AdjustWindowStyle; override; - procedure HandleShow; override; - procedure HandleHide; override; procedure HandleClose; virtual; procedure ProcessPopupFrame; virtual; procedure DoPaintPopupFrame; virtual; @@ -220,18 +218,6 @@ begin Exclude(FWindowAttributes, waSizeable); end; -procedure TfpgPopupWindow.HandleShow; -begin - inherited HandleShow; -// CaptureMouse; -end; - -procedure TfpgPopupWindow.HandleHide; -begin -// ReleaseMouse; - inherited HandleHide; -end; - procedure TfpgPopupWindow.HandleClose; begin HandleHide; @@ -305,6 +291,11 @@ procedure TfpgPopupWindow.Close; begin HandleClose; PopupListRemove(self); + { TODO : Move this out to the GDI specific unit. } + {$IFDEF MSWINDOWS} + if uFirstPopup <> nil then + uFirstPopup^.Widget.CaptureMouse; + {$ENDIF} end; diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas index 82cf7ba1..d12e6213 100644 --- a/src/gui/gui_combobox.pas +++ b/src/gui/gui_combobox.pas @@ -174,14 +174,17 @@ begin ListBox.SetPosition(0, 0, Width, Height); inherited HandleShow; ActiveWidget := ListBox; +// ActiveWidget.CaptureMouse; end; procedure TDropDownWindow.HandleHide; begin // HandleHide also gets called in TfpgWidget.Destroy so we need a few // if Assigned() tests here. This should be improved on. - if Assigned(FocusRootWidget) then - FocusRootWidget.ReleaseMouse; // for internal ListBox +// if Assigned(ActiveWidget) then +// ActiveWidget.ReleaseMouse; +// if Assigned(FocusRootWidget) then +// FocusRootWidget.ReleaseMouse; // for internal ListBox FocusRootWidget := OriginalFocusRoot; OriginalFocusRoot := nil; diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas index 65fdd209..8e5b847c 100644 --- a/src/gui/gui_menu.pas +++ b/src/gui/gui_menu.pas @@ -19,6 +19,8 @@ unit gui_menu; {$mode objfpc}{$H+} +{.$Define DEBUG} + { TODO: * Refactor the HotKey painting code into Canvas.DrawString so that other @@ -944,13 +946,17 @@ end; procedure TfpgPopupMenu.HandleShow; begin +// CaptureMouse; PrepareToShow; inherited HandleShow; end; procedure TfpgPopupMenu.HandleClose; begin - ReleaseMouse; + {$IFDEF DEBUG} + writeln(Classname, '.HandleClose'); + {$ENDIF} +// ReleaseMouse; inherited HandleClose; end; @@ -1092,16 +1098,22 @@ end; procedure TfpgPopupMenu.HandleMouseEnter; begin + {$IFDEF DEBUG} + writeln(Classname, '.HandleMouseEnter'); + {$ENDIF} +// CaptureMouse; inherited HandleMouseEnter; - CaptureMouse; end; procedure TfpgPopupMenu.HandleMouseExit; begin - ReleaseMouse; + {$IFDEF DEBUG} + writeln(Classname, '.HandleMouseExit'); + {$ENDIF} inherited HandleMouseExit; FFocusItem := 0; Repaint; +// ReleaseMouse; end; // Collecting visible items and measuring sizes @@ -1205,6 +1217,10 @@ end; destructor TfpgPopupMenu.Destroy; begin + {$IFDEF DEBUG} + writeln(Classname, '.Destroy'); + {$ENDIF} +// ReleaseMouse; FItems.Free; inherited Destroy; end; |