Here is another patch.
makes labels,brushes work.

Index: wincecallback.inc
===================================================================
--- wincecallback.inc   (revision 9161)
+++ wincecallback.inc   (working copy)
@@ -863,15 +863,15 @@
     End;
     WM_CLOSE:
     Begin
-//      if (Window = TWinCEWidgetSet(WidgetSet).AppHandle) and
-//        (Application.MainForm <> nil) then
+      if (Window = TWinCEWidgetSet(WidgetSet).AppHandle) and
+        (Application.MainForm <> nil) then
       begin
         Windows.SendMessage(Application.MainForm.Handle, WM_CLOSE, 0, 0);
-        Application.Terminate;
+       // Application.Terminate;
+      end
+      else begin
+        LMessage.Msg := LM_CLOSEQUERY;
       end;
-//      else begin
-//        LMessage.Msg := LM_CLOSEQUERY;
-//      end;
       // default is to destroy window, inhibit
       WinProcess := false;
     End;
Index: winceobject.inc
===================================================================
--- winceobject.inc     (revision 9161)
+++ winceobject.inc     (working copy)
@@ -48,6 +48,9 @@
 end;

 procedure TWinCEWidgetSet.AppInit(var ScreenInfo: TScreenInfo);
+var
+  Handle: HWND;
+  DC: HDC;
 begin
   {$ifdef VerboseWinCE}
   WriteLn('TWinCEWidgetSet.AppInit');
@@ -84,13 +87,27 @@
   FStockWhiteBrush := CreateBrushIndirect(LogBrush);
 }

+  // Create parent of all windows, `button on taskbar'
+//does this work on wince?!
+ FAppHandle := CreateWindow(@ClsName, CreatePWideCharFromString(Application.Title), WS_POPUP or
+    WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX,
+    0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
+    0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
+    0, 0, HWND(nil), HMENU(nil), HInstance, nil);
+  AllocWindowInfo(FAppHandle);
+
+  // set nice main icon
+  SendMessage(FAppHandle, WM_SETICON, ICON_BIG,
+    Windows.LoadIcon(MainInstance, 'MAINICON'));
+  // remove useless menuitems from sysmenu
+
  // initialize ScreenInfo
-{  Handle := GetDesktopWindow;
+  Handle := GetDesktopWindow;
   DC := Windows.GetDC(Handle);
   ScreenInfo.PixelsPerInchX := GetDeviceCaps(DC, LOGPIXELSX);
   ScreenInfo.PixelsPerInchY := GetDeviceCaps(DC, LOGPIXELSY);
   ScreenInfo.ColorDepth := GetDeviceCaps(DC, BITSPIXEL);
-  ReleaseDC(Handle, DC);}
+  ReleaseDC(Handle, DC);

 end;

Index: winceproc.pp
===================================================================
--- winceproc.pp        (revision 9161)
+++ winceproc.pp        (working copy)
@@ -45,6 +45,10 @@
 function DisposeWindowInfo(Window: HWND): boolean;
 function GetWindowInfo(Window: HWND): PWindowInfo;

+//roozbeh:these are simply copy-pasted from win32...i bet most of them can be changed
+//or not that much neccessary on wince!
+function LCLControlSizeNeedsUpdate(Sender: TWinControl;SendSizeMsgOnDiff: boolean): boolean; +Procedure LCLBoundsToWin32Bounds(Sender: TObject;var Left, Top, Width, Height: Integer); procedure LCLFormSizeToWin32Size(Form: TCustomForm; var AWidth, AHeight: Integer); function GetLCLClientBoundsOffset(Sender: TObject; var ORect: TRect): boolean;
 function GetLCLClientBoundsOffset(Handle: HWnd; var Rect: TRect): boolean;
@@ -125,6 +129,25 @@



+function GetLCLClientBoundsOffset(Handle: HWnd; var Rect: TRect): boolean;
+var
+  OwnerObject: TObject;
+begin
+  OwnerObject := GetWindowInfo(Handle)^.WinControl;
+  Result:=GetLCLClientBoundsOffset(OwnerObject, Rect);
+end;
+
+Procedure LCLBoundsToWin32Bounds(Sender: TObject;
+  var Left, Top, Width, Height: Integer);
+var
+  ORect: TRect;
+Begin
+  if (Sender=nil) or (not (Sender is TWinControl)) then exit;
+ if not GetLCLClientBoundsOffset(TWinControl(Sender).Parent, ORect) then exit;
+  inc(Left, ORect.Left);
+  inc(Top, ORect.Top);
+End;
+
 
{-------------------------------------------------------------------------------
   function GetLCLClientOriginOffset(Sender: TObject;
     var LeftOffset, TopOffset: integer): boolean;
@@ -194,13 +217,6 @@
   Result:=true;
 end;

-function GetLCLClientBoundsOffset(Handle: HWnd; var Rect: TRect): boolean;
-var
-  OwnerObject: TObject;
-begin
-  OwnerObject := GetWindowInfo(Handle)^.WinControl;
-  Result:=GetLCLClientBoundsOffset(OwnerObject, Rect);
-end;

procedure GetWin32ControlPos(Window, Parent: HWND; var Left, Top: integer);
 var
@@ -212,6 +228,45 @@
   Top := winRect.Top - parRect.Top;
 end;

+
+{-------------------------------------------------------------------------------
+  function LCLBoundsNeedsUpdate(Sender: TWinControl;
+    SendSizeMsgOnDiff: boolean): boolean;
+
+  Returns true if LCL bounds and win32 bounds differ for the control.
+-------------------------------------------------------------------------------}
+function LCLControlSizeNeedsUpdate(Sender: TWinControl;
+  SendSizeMsgOnDiff: boolean): boolean;
+var
+  Window:HWND;
+  LMessage: TLMSize;
+  IntfWidth, IntfHeight: integer;
+begin
+  Result:=false;
+  Window:= Sender.Handle;
+  LCLIntf.GetWindowSize(Window, IntfWidth, IntfHeight);
+  if (Sender.Width = IntfWidth)
+  and (Sender.Height = IntfHeight)
+  and (not Sender.ClientRectNeedsInterfaceUpdate) then
+    exit;
+  Result:=true;
+  if SendSizeMsgOnDiff then begin
+ //writeln('LCLBoundsNeedsUpdate B ',TheWinControl.Name,':',TheWinControl.ClassName,' Sending WM_SIZE');
+    Sender.InvalidateClientRectCache(true);
+ // send message directly to LCL, some controls not subclassed -> message
+    // never reaches LCL
+    with LMessage do
+    begin
+      Msg := LM_SIZE;
+      SizeType := SIZE_RESTORED or Size_SourceIsInterface;
+      Width := IntfWidth;
+      Height := IntfHeight;
+    end;
+    DeliverMessage(Sender, LMessage);
+  end;
+end;
+
+
 {
   Updates the window style of the window indicated by Handle.
   The new style is the Style parameter.
Index: wincewinapi.inc
===================================================================
--- wincewinapi.inc     (revision 9161)
+++ wincewinapi.inc     (working copy)
@@ -221,18 +221,23 @@
     AlwaysCreateMask);
 end;}

-{Function TWinCEWidgetSet.CreateBrushIndirect(Const LogBrush: TLogBrush): HBRUSH; +Function TWinCEWidgetSet.CreateBrushIndirect(Const LogBrush: TLogBrush): HBRUSH;
 Var
   LB: Windows.LogBrush;
 Begin
   LB.lbStyle := LogBrush.lbStyle;
   LB.lbColor := Windows.COLORREF(ColorToRGB(LogBrush.lbColor));
   LB.lbHatch := LogBrush.lbHatch;
- Assert(False, Format('Trace:> [TWin32WidgetSet.CreateBrushIndirect] Style: %d, Color: %8x', [lb.lbStyle, lb.lbColor]));
-//  Result := Windows.CreateBrushIndirect(LB);
-  Result := Windows.CreatesBrushIndirect(LB);
- Assert(False, Format('Trace:< [TWin32WidgetSet.CreateBrushIndirect] Got --> %x', [Result]));
-End;}
+ Assert(False, Format('Trace:> [TWinCEWidgetSet.CreateBrushIndirect] Style: %d, Color: %8x', [lb.lbStyle, lb.lbColor]));
+  Result := 0;
+  if lb.lbStyle = BS_SOLID then
+  Result := Windows.CreateSolidBrush(LB.lbColor);
+  if lb.lbStyle= BS_NULL then
+  Result := Windows.GetStockObject(NULL_BRUSH);
+  if lb.lbStyle = BS_DIBPATTERNPT then
+  Result := CreateDIBPatternBrushPt(pointer(lb.lbHatch), lb.lbColor);
+ Assert(False, Format('Trace:< [TWinCEWidgetSet.CreateBrushIndirect] Got --> %x', [Result]));
+End;

 {------------------------------------------------------------------------------
   Method:  CreateCaret
@@ -425,11 +430,7 @@
Assert(False, Format('trace:> [TWinCEWidgetSet.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d', [DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
   WideStr := CreatePWideCharFromString(String(str));
- dc:=getdc(0);
- SetTextColor(dc,GetSysColor(COLOR_WINDOWTEXT));
- rect.Left:=10;rect.top:=10;rect.Right:=90;rect.bottom:=90;
-
- Result := Windows.DrawText(DC, 'salam', -1, @Rect, DT_LEFT or DT_TOP or DT_WORDBREAK );
+  Result := Windows.DrawText(DC, WideStr, Count, @Rect, Flags);
   DisposePWideChar(WideStr);
Assert(False, Format('trace:> [TWinCEWidgetSet.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d', [DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
@@ -515,11 +516,11 @@
Assert(False, Format('trace:< [TWin32WidgetSet.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count]));
 End;

-{function TWinCEWidgetSet.ExtSelectClipRGN(dc: hdc; rgn: hrgn; Mode: Longint +function TWinCEWidgetSet.ExtSelectClipRGN(dc: hdc; rgn: hrgn; Mode: Longint
   ): Integer;
 begin
   Result:=inherited ExtSelectClipRGN(dc, rgn, Mode);
-end;}
+end;

 {------------------------------------------------------------------------------
   Method:  FillRect
@@ -890,7 +891,7 @@
 Begin
   if NIndex = COLOR_FORM then
     NIndex := COLOR_BTNFACE;
-  Result := Windows.GetSysColor(nIndex);
+  Result := Windows.GetSysColor(nIndex or $40000000);
 End;

 {------------------------------------------------------------------------------
@@ -955,27 +956,27 @@
 Begin
Assert(False, Format('Trace:> TODO FINISH[TWinCEWidgetSet.GetTextMetrics] DC: 0x%x', [DC]));
   Result := Boolean(Windows.GetTextMetrics(DC, @TMw));
-    TM.tmHeight:= TMW.tmHeight;
-    TM.tmAscent:= TMW.tmAscent;
-    TM.tmDescent:= TMW.tmDescent;
-    TM.tmInternalLeading:= TMW.tmInternalLeading;
-    TM.tmExternalLeading:= TMW.tmExternalLeading;
-    TM.tmAveCharWidth:= TMW.tmAveCharWidth;
-    TM.tmMaxCharWidth:= TMW.tmMaxCharWidth;
-    TM.tmWeight:= TMW.tmWeight;
-    TM.tmOverhang:= TMW.tmOverhang;
-    TM.tmDigitizedAspectX:= TMW.tmDigitizedAspectX;
-    TM.tmDigitizedAspectY:= TMW.tmDigitizedAspectY;
-    TM.tmFirstChar:= TMW.tmFirstChar;
-    TM.tmLastChar:= TMW.tmLastChar;
-    TM.tmDefaultChar:= TMW.tmDefaultChar;
-    TM.tmBreakChar:= TMW.tmBreakChar;
-    TM.tmItalic:= TMW.tmItalic;
-    TM.tmUnderlined:= TMW.tmUnderlined;
-    TM.tmStruckOut:= TMW.tmStruckOut;
-    TM.tmPitchAndFamily:= TMW.tmPitchAndFamily;
-    TM.tmCharSet:= TMW.tmCharSet;
- Assert(False, Format('Trace:< TODO FINISH[TWinCEWidgetSet.GetTextMetrics] DC: 0x%x', [DC]));
+  TM.tmHeight:= TMW.tmHeight;
+  TM.tmAscent:= TMW.tmAscent;
+  TM.tmDescent:= TMW.tmDescent;
+  TM.tmInternalLeading:= TMW.tmInternalLeading;
+  TM.tmExternalLeading:= TMW.tmExternalLeading;
+  TM.tmAveCharWidth:= TMW.tmAveCharWidth;
+  TM.tmMaxCharWidth:= TMW.tmMaxCharWidth;
+  TM.tmWeight:= TMW.tmWeight;
+  TM.tmOverhang:= TMW.tmOverhang;
+  TM.tmDigitizedAspectX:= TMW.tmDigitizedAspectX;
+  TM.tmDigitizedAspectY:= TMW.tmDigitizedAspectY;
+  TM.tmFirstChar:= TMW.tmFirstChar;
+  TM.tmLastChar:= TMW.tmLastChar;
+  TM.tmDefaultChar:= TMW.tmDefaultChar;
+  TM.tmBreakChar:= TMW.tmBreakChar;
+  TM.tmItalic:= TMW.tmItalic;
+  TM.tmUnderlined:= TMW.tmUnderlined;
+  TM.tmStruckOut:= TMW.tmStruckOut;
+  TM.tmPitchAndFamily:= TMW.tmPitchAndFamily;
+  TM.tmCharSet:= TMW.tmCharSet;
+ Assert(False, Format('Trace:< TODO FINISH[TWinCEWidgetSet.GetTextMetrics] DC: 0x%x', [DC]));
 End;

 {------------------------------------------------------------------------------
@@ -1228,26 +1229,72 @@
   );
 begin
   inherited LeaveCriticalSection(CritSection);
-end;
+end;}

-function TWinCEWidgetSet.LineTo(DC: HDC; X, Y: Integer): Boolean;
-begin
-  Result:=inherited LineTo(DC, X, Y);
-end;
+{------------------------------------------------------------------------------
+  Method:  LineTo
+  Params:  DC - device context handle
+           X  - x-coordinate of line's ending point
+           Y  - y-coordinate of line's ending point
+  Returns: if the function succeeds

-function TWinCEWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar;
-  uType: Cardinal): integer;
-begin
-  Result:=inherited MessageBox(hWnd, lpText, lpCaption, uType);
-end;
+ Draws a line from the current position up to, but not including, the specified point.
+ 
------------------------------------------------------------------------------}
+Function TWinCEWidgetSet.LineTo(DC: HDC; X, Y: Integer): Boolean;
+Begin
+ Assert(False, Format('Trace:> [TWinCEWidgetSet.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
+  Result := Boolean(Windows.LineTo(DC, X, Y));
+ Assert(False, Format('Trace:< [TWinCEWidgetSet.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
+End;

-function TWinCEWidgetSet.MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint
-  ): Boolean;
-begin
-  Result:=inherited MoveToEx(DC, X, Y, OldPoint);
-end;
+{------------------------------------------------------------------------------
+  Method:  MessageBox
+  Params:  HWnd      - The handle of parent window
+           LPText    - text in message box
+           LPCaption - title of message box
+           UType     - style of message box
+ Returns: 0 if not successful (out of memory), otherwise one of the defined
+           values:
+             IDABORT
+             IDCANCEL
+             IDIGNORE
+             IDNO
+             IDOK
+             IDRETRY
+             IDYES

-function TWinCEWidgetSet.MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; + The MessageBox function displays a modal dialog, with text and caption defined,
+ and includes buttons.
+ 
------------------------------------------------------------------------------}
+Function TWinCEWidgetSet.MessageBox(HWnd: HWND; LPText, LPCaption: PChar; UType: Cardinal): Integer;
+var
+LPWCaption,LPWText : PWideChar;
+Begin
+  LPWCaption := CreatePWideCharFromString(String(LPCaption));
+  LPWText := CreatePWideCharFromString(String(LPText));
+  Result := Windows.MessageBox(HWnd, LPWText, LPWCaption, UType);
+  DisposePWideChar(LPWCaption);
+  DisposePWideChar(LPWText);
+End;
+
+{------------------------------------------------------------------------------
+  Method:  MoveToEx
+  Params:  DC       - handle of device context
+           X        - x-coordinate of new current position
+           Y        - x-coordinate of new current position
+           OldPoint - address of old current position
+  Returns: If the function succeeds.
+
+  Updates the current position to the specified point.
+ 
------------------------------------------------------------------------------}
+Function TWinCEWidgetSet.MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean;
+Begin
+ Assert(False, Format('Trace:> [TWinCEWidgetSet.MoveToEx] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
+  Result := Boolean(Windows.MoveToEx(DC, X, Y, LPPOINT(OldPoint)));
+ Assert(False, Format('Trace:< [TWinCEWidgetSet.MoveToEx] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
+End;
+
+{function TWinCEWidgetSet.MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean;
 begin
   Result:=inherited MoveWindowOrgEx(DC, dX, dY);
 end;
@@ -1275,32 +1322,80 @@
   Result:=inherited PairSplitterSetPosition(SplitterHandle, NewPosition);
 end;

-function TWinCEWidgetSet.PeekMessage(var lpMsg: TMsg; Handle: HWND;
-  wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): Boolean;
-begin
- Result:=inherited PeekMessage(lpMsg, Handle, wMsgFilterMin, wMsgFilterMax,
-    wRemoveMsg);
-end;

function TWinCEWidgetSet.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer;
   Filled, Continuous: boolean): boolean;
 begin
   Result:=inherited PolyBezier(DC, Points, NumPts, Filled, Continuous);
-end;
+end;}

-function TWinCEWidgetSet.Polygon(DC: HDC; Points: PPoint; NumPts: Integer;
-  Winding: boolean): boolean;
-begin
-  Result:=inherited Polygon(DC, Points, NumPts, Winding);
-end;
+{------------------------------------------------------------------------------
+  Method:  PeekMessage
+  Params:  LPMsg         - Where it should put the message
+           Handle        - Handle of the window (thread)
+           WMsgFilterMin - Lowest MSG to grab
+           WMsgFilterMax - Highest MSG to grab
+           WRemoveMsg    - Should message be pulled out of the queue
+  Returns: Boolean if an event was there

-function TWinCEWidgetSet.Polyline(DC: HDC; Points: PPoint; NumPts: Integer
-  ): boolean;
-begin
-  Result:=inherited Polyline(DC, Points, NumPts);
-end;}
+  Checks a thread message queue for a message.
+ 
------------------------------------------------------------------------------}
+Function TWinCEWidgetSet.PeekMessage(Var LPMsg: TMsg; Handle: HWND; WMsgFilterMin, WMsgFilterMax, WRemoveMsg: UINT): Boolean;
+Begin
+ Result := Boolean(Windows.PeekMessage(@LPMsg, Handle, WMsgFilterMin, WMsgFilterMax, WRemoveMsg));
+End;

 {------------------------------------------------------------------------------
+  Method:  Polygon
+  Params:  DC - handle to device context
+           Points - pointer to polygon's vertices
+           NumPts - count of polygon's vertices
+           Winding
+  Returns: If the function succeeds
+
+ Use Polygon to draw a closed, many-sided shape on the canvas, using the value + of Pen. After drawing the complete shape, Polygon fills the shape using the
+  value of Brush.
+  The Points parameter is an array of points that give the vertices of the
+  polygon.
+  Winding determines how the polygon is filled.
+  When Winding is True, Polygon
+  fills the shape using the Winding fill algorithm. When Winding is False,
+  Polygon uses the even-odd (alternative) fill algorithm.
+  NumPts indicates the number of points to use.
+  The first point is always connected to the last point.
+ To draw a polygon on the canvas, without filling it, use the Polyline method,
+  specifying the first point a second time at the end.
+ 
------------------------------------------------------------------------------}
+Function TWinCEWidgetSet.Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: Boolean): Boolean;
+var
+  PFMode : Longint;
+Begin
+ Assert(False, Format('Trace:TWinCEWidgetSet.Polygon --> DC: 0x%X, Number of points: %D, Use winding fill: %S', [DC, NumPts, BOOL_RESULT[Winding]]));
+//  If Winding then
+//    PFMode := SetPolyFillMode(DC, Windows.WINDING)
+//  else
+//    PFMode := SetPolyFillMode(DC, Windows.ALTERNATE);
+  Result := Boolean(Windows.Polygon(DC, LPPOINT(Points), NumPts));
+//  SetPolyFillMode(DC, PFMode);
+End;
+
+{------------------------------------------------------------------------------
+  Method:  Polyline
+  Params:  DC - handle of device context
+           Points - address of array containing endpoints
+           NumPts - number of points in the array
+  Returns: If the function succeeds
+
+ Draws a series of line segments by connecting the points in the specified
+  array.
+ 
------------------------------------------------------------------------------}
+Function TWinCEWidgetSet.Polyline(DC: HDC; Points: PPoint; NumPts: Integer): Boolean;
+Begin
+  Result := Boolean(Windows.Polyline(DC, LPPOINT(Points), NumPts));
+End;
+
+{------------------------------------------------------------------------------
   Method:  PostMessage
   Params: Handle - handle of destination window
           Msg - message to post
@@ -1337,19 +1432,33 @@
 function TWinCEWidgetSet.RealizePalette(DC: HDC): Cardinal;
 begin
   Result:=inherited RealizePalette(DC);
-end;
+end;}

-function TWinCEWidgetSet.Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean;
-begin
-  Result:=inherited Rectangle(DC, X1, Y1, X2, Y2);
-end;
+{------------------------------------------------------------------------------
+  Method:  Rectangle
+  Params:  DC - handle of device context
+           X1 - x-coordinate of bounding rectangle's upper-left corner
+           Y1 - y-coordinate of bounding rectangle's upper-left corner
+           X2 - x-coordinate of bounding rectangle's lower-right corner
+           Y2 - y-coordinate of bounding rectangle's lower-right corner
+  Returns: If the function succeeds

-function TWinCEWidgetSet.RectVisible(dc: hdc; const ARect: TRect): Boolean; + The Rectangle function draws a rectangle. The rectangle is outlined by using
+  the current pen and filled by using the current brush.
+ 
------------------------------------------------------------------------------}
+Function TWinCEWidgetSet.Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean;
+Begin
+ Assert(False, Format('Trace:> [TWinCEWidgetSet.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2]));
+  Result := Boolean(Windows.Rectangle(DC, X1, Y1, X2+1, Y2+1));
+ Assert(False, Format('Trace:< [TWinCEWidgetSet.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2]));
+End;
+
+function TWinCEWidgetSet.RectVisible(dc : hdc; const ARect: TRect) : Boolean;
 begin
-  Result:=inherited RectVisible(dc, ARect);
+  Result := Boolean(Windows.RectVisible(DC, LPRECT(@ARect)^));
 end;

-function TWinCEWidgetSet.RegroupMenuItem(hndMenu: HMENU; GroupIndex: integer +{function TWinCEWidgetSet.RegroupMenuItem(hndMenu: HMENU; GroupIndex: integer
   ): Boolean;
 begin
   Result:=inherited RegroupMenuItem(hndMenu, GroupIndex);
@@ -1608,14 +1717,14 @@
   ): Boolean;
 begin
   Result:=inherited SetProp(Handle, Str, Data);
-end;
+end;}

 function TWinCEWidgetSet.SetROP2(DC: HDC; Mode: Integer): Integer;
 begin
   Result:=inherited SetROP2(DC, Mode);
 end;

-function TWinCEWidgetSet.SetScrollInfo(Handle: HWND; SBStyle: Integer;
+{function TWinCEWidgetSet.SetScrollInfo(Handle: HWND; SBStyle: Integer;
   ScrollInfo: TScrollInfo; bRedraw: Boolean): Integer;
 begin
   Result:=inherited SetScrollInfo(Handle, SBStyle, ScrollInfo, bRedraw);
@@ -1673,17 +1782,24 @@
Assert(False, Format('Trace:< [TWin32WidgetSet.SETWINDOWLONG] HWND: 0x%x, Idx: 0x%x(%d), Value: 0x%x(%d) --> 0x%x(%d)', [Handle, Idx, Idx, NewLong, NewLong, Result, Result]));
 End;

-{function TWinCEWidgetSet.SetWindowLong(Handle: HWND; Idx: Integer;
-  NewLong: PtrInt): PtrInt;
-begin
-  Result:=inherited SetWindowLong(Handle, Idx, NewLong);
-end;
+{------------------------------------------------------------------------------
+  Method:  SetWindowOrgEx
+  Params:  DC    - handle of device context
+           NewX  - new x-coordinate of window origin
+           NewY  - new y-coordinate of window origin
+           Point - record receiving original origin
+  Returns: Whether the call was successful

-function TWinCEWidgetSet.SetWindowOrgEx(dc: hdc; NewX, NewY: Integer;
+ Sets the window origin of the device context by using the specified coordinates.
+ 
------------------------------------------------------------------------------}
+//roozbeh:does this always work?it is heavily used in labels and some other drawing controls!
+Function TWinCEWidgetSet.SetWindowOrgEx(DC: HDC; NewX, NewY: Integer;
   OldPoint: PPoint): Boolean;
-begin
-  Result:=inherited SetWindowOrgEx(dc, NewX, NewY, OldPoint);
-end;}
+Begin
+ Result := Boolean(SetViewPortOrgEx(DC, -NewX, -NewY, LPPoint(OldPoint)));
+//  Result:=inherited SetWindowOrgEx(dc, NewX, NewY, OldPoint);
+End;
+
 {------------------------------------------------------------------------------
   Method:  SetWindowPos
   Params: HWnd            - handle of window
Index: wincewinapih.inc
===================================================================
--- wincewinapih.inc    (revision 9161)
+++ wincewinapih.inc    (working copy)
@@ -63,7 +63,7 @@
//function ComboBoxDropDown(Handle: HWND; DropDown: boolean): boolean; override; function CreateBitmap(Width, Height: Integer; Planes, BitCount: Longint; BitmapBits: Pointer): HBITMAP; override; //function CreateBitmapFromRawImage(const RawImage: TRawImage; var Bitmap, MaskBitmap: HBitmap; AlwaysCreateMask: boolean): boolean; override; -//function CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; override;
+function CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; override;
function CreateCaret(Handle : HWND; Bitmap : hBitmap; width, Height : Integer) : Boolean; override; function CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBITMAP; override;
 function CreateCompatibleDC(DC: HDC): HDC; override;
@@ -92,7 +92,7 @@
function EnumFontFamiliesEx(DC: HDC; lpLogFont: PLogFont; Callback: FontEnumExProc; Lparam: LParam; Flags: dword): longint; override; function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; override;} function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override; -{function ExtSelectClipRGN(dc: hdc; rgn : hrgn; Mode : Longint) : Integer; override;} +function ExtSelectClipRGN(dc: hdc; rgn : hrgn; Mode : Longint) : Integer; override;

function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; override;
 //function Frame(DC: HDC; const ARect: TRect): Integer; override;
@@ -155,31 +155,31 @@
function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; override;
 function IsWindowEnabled(handle: HWND): boolean; override;
 function IsWindowVisible(handle: HWND): boolean; override;
-{
-Procedure LeaveCriticalSection(var CritSection: TCriticalSection); Override;
+
+//Procedure LeaveCriticalSection(var CritSection: TCriticalSection); Override;
 function LineTo(DC: HDC; X, Y: Integer): Boolean; override;

function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override; function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
-function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;
+{function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;

function PairSplitterAddSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; override;
 function PairSplitterGetInterfaceInfo: Boolean; override;
function PairSplitterRemoveSide(SplitterHandle, SideHandle: hWnd; Side: integer): Boolean; override; -function PairSplitterSetPosition(SplitterHandle: hWnd; var NewPosition: integer): Boolean; override; +function PairSplitterSetPosition(SplitterHandle: hWnd; var NewPosition: integer): Boolean; override;} function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override; -function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override; +//function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override; function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override; -function Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean; override;} +function Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean; override; function PostMessage(Handle: HWND; Msg: Cardinal; wParam: WParam; lParam: LParam): Boolean; override;

{function RadialArc(DC: HDC; x,y,width,height,sx,sy,ex,ey : Integer): Boolean; override; function RadialChord(DC: HDC; x,y,width,height,sx,sy,ex,ey : Integer): Boolean; override; function RadialPie(DC: HDC; x,y,width,height,sx,sy,ex,ey : Integer): Boolean; override;
-function RealizePalette(DC: HDC): Cardinal; override;
+function RealizePalette(DC: HDC): Cardinal; override;}
 function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; override;
 function RectVisible(dc : hdc; const ARect: TRect) : Boolean; override;
-function RegroupMenuItem(hndMenu: HMENU; GroupIndex: integer): Boolean; override; +{function RegroupMenuItem(hndMenu: HMENU; GroupIndex: integer): Boolean; override;
 Function ReleaseCapture : Boolean; override;}
 function ReleaseDC(Window: HWND; DC: HDC): Integer; override;
 //function RemoveProp(Handle: hwnd; Str: PChar): THandle; override;
@@ -203,14 +203,14 @@
function SetCaretRespondToFocus(handle: HWND; ShowHideOnFocus: boolean): Boolean; override;
 function SetCursorPos(X, Y: Integer): Boolean; override;
 function SetFocus(hWnd: HWND): HWND; override;
-Function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override; +Function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override;}
 function SetROP2(DC: HDC; Mode: Integer): Integer; override;
-function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;} +{function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;} function SetSysColors(cElements: Integer; const lpaElements; const lpaRgbValues): Boolean; override; {Function SetTextCharacterExtra(_hdc : hdc; nCharExtra : Integer):Integer; override;}
 function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong: PtrInt): PtrInt; override; -//function SetWindowOrgEx(dc : hdc; NewX, NewY : Integer; OldPoint: PPoint) : Boolean; override; +function SetWindowOrgEx(dc : hdc; NewX, NewY : Integer; OldPoint: PPoint) : Boolean; override;
 function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
       X, Y, cx, cy: Integer; uFlags: UINT): Boolean;  override;
 {function ShowCaret(hWnd: HWND): Boolean; override;
Index: wincewscontrols.pp
===================================================================
--- wincewscontrols.pp  (revision 9161)
+++ wincewscontrols.pp  (working copy)
@@ -195,11 +195,11 @@
       if TCustomControl(AWinControl).BorderStyle = bsSingle then
         FlagsEx := FlagsEx or WS_EX_CLIENTEDGE;
     {$IFDEF VerboseSizeMsg}
- writeln('TWin32WidgetSet.CreateComponent A ',AWinControl.Name,':',AWinControl.ClassName,' ',Left,',',Top,',',Width,',',Height); + writeln('TWinCEWidgetSet.CreateComponent A ',AWinControl.Name,':',AWinControl.ClassName,' ',Left,',',Top,',',Width,',',Height);
     {$ENDIF}

- //Assert(False, Format('Trace:TWin32WidgetSet.CreateComponent - Creating component %S with the caption of %S', [AWinControl.ClassName, AWinControl.Caption])); - //Assert(False, Format('Trace:TWin32WidgetSet.CreateComponent - Left: %D, Top: %D, Width: %D, Height: %D, Parent handle: 0x%X, instance handle: 0x%X', [Left, Top, Width, Height, Parent, HInstance])); + //Assert(False, Format('Trace:TWinCEWidgetSet.CreateComponent - Creating component %S with the caption of %S', [AWinControl.ClassName, AWinControl.Caption])); + //Assert(False, Format('Trace:TWinCEWidgetSet.CreateComponent - Left: %D, Top: %D, Width: %D, Height: %D, Parent handle: 0x%X, instance handle: 0x%X', [Left, Top, Width, Height, Parent, HInstance]));
   end;
 end;

@@ -395,7 +395,6 @@

     if AfterWnd = 0 then Exit; // nothing to do
   end;
-
   Windows.SetWindowPos(AChild.Handle, AfterWnd, 0, 0, 0, 0,
     SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOOWNERZORDER or
     SWP_NOSIZE or SWP_NOSENDCHANGING);
@@ -416,20 +415,20 @@
   IntfLeft, IntfTop, IntfWidth, IntfHeight: integer;
   suppressMove: boolean;
 begin
-(*  IntfLeft := ALeft; IntfTop := ATop;
+  IntfLeft := ALeft; IntfTop := ATop;
   IntfWidth := AWidth; IntfHeight := AHeight;
LCLBoundsToWin32Bounds(AWinControl, IntfLeft, IntfTop, IntfWidth, IntfHeight);
   {$IFDEF VerboseSizeMsg}
- writeln('TWin32WSWinControl.ResizeWindow A ',AWinControl.Name,':',AWinControl.ClassName, + writeln('TWinCEWSWinControl.ResizeWindow A ',AWinControl.Name,':',AWinControl.ClassName,
     ' LCL=',ALeft,',',ATop,',',AWidth,',',AHeight,
     ' Win32=',IntfLeft,',',IntfTop,',',IntfWidth,',',IntfHeight,
     '');
   {$ENDIF}
   suppressMove := false;
AdaptBounds(AWinControl, IntfLeft, IntfTop, IntfWidth, IntfHeight, suppressMove);
-  if not suppressMove then
- MoveWindow(AWinControl.Handle, IntfLeft, IntfTop, IntfWidth, IntfHeight, true);
-  LCLControlSizeNeedsUpdate(AWinControl, false);*)
+//  if not suppressMove then
+// MoveWindow(AWinControl.Handle, IntfLeft, IntfTop, IntfWidth, IntfHeight, true);
+  LCLControlSizeNeedsUpdate(AWinControl, false);
 end;

 procedure TWinCEWSWinControl.SetColor(const AWinControl: TWinControl);
@@ -489,7 +488,7 @@
 // which actually implement something
 ////////////////////////////////////////////////////
 //  RegisterWSComponent(TDragImageList, TWSDragImageList);
-  RegisterWSComponent(TControl, TWinCEWSControl);
+//  RegisterWSComponent(TControl, TWinCEWSControl);
   RegisterWSComponent(TWinControl, TWinCEWSWinControl);
 //  RegisterWSComponent(TGraphicControl, TWSGraphicControl);
 //  RegisterWSComponent(TCustomControl, TWSCustomControl);

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

Reply via email to