Yuri,
After some more investigation, it seems like 240x320 compatibility mode mucks with sizes a bit here and there. As a result (I think) WM_SIZE gets a slightly different value as response to SetWindowPos calls than was originally used in the SetWindowPos call itself. This creates in infinite loop of calls of SetBoundsRect, which loops back to itself, because:
if RectsEqual( Value, Rect ) then Exit;
in SetBoundsRect is never satisfied.
I've adjusted the RectsEqual function as following:
//[FUNCTION RectsEqual]
{$IFDEF ASM_VERSION}
{$ELSE ASM_VERSION} //Pascal
function RectsEqual( const R1, R2: TRect ): Boolean;
begin
// Result := CompareMem( @R1, @R2, Sizeof( TRect ) );
Result :=
(Abs(R1.Top - R2.Top) <= 1) AND
(Abs(R1.Left - R2.Left) <= 1) AND
(Abs(R1.Bottom - R2.Bottom) <= 1) AND
(Abs(R1.Right - R2.Right) <= 1);
end;
{$ENDIF ASM_VERSION}
//[END RectsEqual]
This fixes the issue on the emulator, though it is ofcourse not an elegant solution (I will send it to someone with a Treo800w to see if it fixes the issue there too). Maybe a DEFINE should be used to turn this functionality on and off ?