f



Window size values are ignored

Hello,
  Something has changed in the program code and I do not see it. Two
buttons are placed next to a dropdown listbox to allow adding or
deleting items selected in the listbox. The button sizes are set to 20x20,
yet when displayed the buttons and assigned images have been resized to 28x28.

  Why is this button being resized to 28x28? (!)

  Below is the code used to create the composition window and the
add/delete buttons.

  The resource assignment in the .rc file:
BITMAP IDW_TOADD ".\\bitmaps\\addo.bmp"
  The image size of "addo.bmp" is 20x20.

  The main window is created with:
Global.Fcf = FCF_STANDARD | FCF_NOBYTEALIGN;
Frame = WinCreateStdWindow(HWND_DESKTOP,
                           0, &Global.Fcf,
                           "PMMailCompWin", title,
                           0, NULLHANDLE, IDW_COMPWIN,
                           &Client1);
CompWinFrame = WinSubclassWindow(Frame, CompWinFrameProc);

  The button is created with:
WinCreateWindow(Client, WC_BUTTON, "",
                WS_VISIBLE | BS_USERBUTTON | BS_NOPOINTERFOCUS,
                0, 0, 0, 0, Client, HWND_TOP, IDW_TOADD,
                NULL, NULL);

  The button is sized and positioned with:
swp_options  = SWP_SHOW | SWP_MOVE | SWP_SIZE;
WinSetWindowPos(Button, HWND_TOP, y_centerline - (20+20+3), EFLine+1,
                20, 20, swp_options);

  The width and height are *explicitly* set to 20x20. That is the size of
the bitmap image of the buttons.
  The return codes indicate success all around.
  I have tried setting with width and height values in WinCreateWindow(),
and removing SWP_SIZE in WinSetWindowPos(). No luck there.


-- 
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
0
Jim
11/5/2009 8:23:34 PM
comp.os.os2.programmer.misc 1326 articles. 0 followers. Post Follow

1 Replies
337 Views

Similar Articles

[PageSpeed] 52

On 11/05/09 01:23 pm, Jim Moe wrote:
> Hello,
>   Something has changed in the program code and I do not see it. Two
> buttons are placed next to a dropdown listbox to allow adding or
> deleting items selected in the listbox. The button sizes are set to 20x20,
> yet when displayed the buttons and assigned images have been resized to 28x28.
> 
>   Why is this button being resized to 28x28? (!)
> 
  Programmer error.
  I had combined seven (almost, as it turns out) identical functions into
a single function. One of the separate functions used a different image
size than the other six did. By using the same constant the final button
in this one case was drawn too large.

-- 
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
0
Jim
11/8/2009 5:58:51 AM
Reply: