Hi Christian,

Creating a patch is dead simple. It's also described here; http://wiki.lazarus.freepascal.org/index.php/Creating_A_Patch

Darius

----- Original Message ----- From: "Christian Budde" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 08, 2006 4:06 PM
Subject: Re: [lazarus] ShowModal implementation (Win32)


Hello again,

I've found a solution, but I'm maybe too stupid to create a patch, so
here is the manual patch:

To have a ShowModal more similar to Delphi, simply change the
HandleCursor procedure in 'win32callback.inc' to this:

 *procedure* HandleSetCursor;
 *var*
   lControl: TControl;
   BoundsOffset: TRect;
 *begin*
   *if* (lWinControl <> nil) *and* *not* (csDesigning in
lWinControl.ComponentState) *then*
     *case* Lo(LParam) *of*
       HTCLIENT:
         *begin*
           Windows.GetCursorPos(Windows.POINT(P));
           Windows.ScreenToClient(Window, Windows.POINT(P));
           *if* GetLCLClientBoundsOffset(lWinControl.Parent,
BoundsOffset) *then*
           *begin*
             Dec(P.X, BoundsOffset.Left);
             Dec(P.Y, BoundsOffset.Top);
           *end;*
           // statictext controls do not get WM_SETCURSOR messages...
           lControl := lWinControl.ControlAtPos(P, false, true);
           *if* lControl = *nil* *then*
             lControl := lWinControl;
           *if* lControl.Cursor <> crDefault *then*
           *begin*
             Windows.SetCursor(Windows.LoadCursor(0,
LclCursorToWin32CursorMap[lControl.Cursor]));
             LMessage.Result := 1;
           *end*;
         *end*;
       HTERROR:
         *begin*
           *if* (Hi(LParam) = WM_LBUTTONDOWN) *and*
(TWin32WidgetSet(WidgetSet).AppHandle <> 0) *and*
             (GetForegroundWindow <>
GetLastActivePopup(TWin32WidgetSet(WidgetSet).AppHandle)) *then*
           *begin*
             Application.BringToFront;
             Exit;
           *end*;
         *end*;
     *end*;
   *if* LMessage.Result = 0 *then*
   *begin*
     LMessage.Msg := LM_SETCURSOR;
     LMessage.WParam := WParam;
     LMessage.LParam := LParam;
   *end*;
   WinProcess := false;
 *end*;


and in 'win32object.inc' change 'AppBringToFront' to

*procedure* TWin32WidgetSet.AppBringToFront;
*var*
 TopWindow: HWnd;
*begin*
 *if* FAppHandle <> 0 *then*
 *begin*
   TopWindow := GetLastActivePopup(FAppHandle);
   *if* (TopWindow <> 0*) and* (TopWindow <> FAppHandle) *and*
     IsWindowVisible(TopWindow) *and* IsWindowEnabled(TopWindow) *then*
     Windows.SetForegroundWindow(TopWindow);
 *end*;
*end;*




_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to