I've been putting together a Win32::GUI tutorial, by basically
developing a little "Hello, world" application, and adding features
incrementally. Everything was going well, until I decided to demonstrate
resize events by keeping my label centred in the main window. The
problem is that the $label->Left($l) and $label->To($t) methods don't
seem to work.

Looking at the code, and the MS documentation, Left() is doing

    GetWindowRect()
    SetWindowPos(..., new_left, old_top, ...)

The problem is that GetWindowRect() returns screen co-ordinates. The
documentation for SetWindowPos says that it requires *client*
coordinates. Now, it looks like it actually requires screen coordinates
for top-level windows (centring the main window on the screen works!),
but client coordinates for child windows.

So I need to convert the values returned from GetWindowRect() to client
coordinates for child windows. That needs me to get the child's parent
and do some sums...

Assuming I haven't missed something (has no-one been using Left/Top
calls on client windows for anything?), I'll put together a patch and
post it...

Paul.

Reply via email to