Sign in to follow this  

Checkbox label

This topic is 4095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone. I'm using c++ (no MFC), and I've created a checkbox using this code...
  m_hWalkableBox = CreateWindowEx(
    0,
    "BUTTON",
    "Walkable?",
    WS_CHILD | WS_VISIBLE | BS_CHECKBOX | BS_RIGHTBUTTON,
    73,
    5,
    13,
    13,
    m_hAttributeWnd,
    (HMENU)CHK_WALKABLE,
    m_hInst,
    NULL
    );



It creates an empty checkbox with a big W in it. The text shows up inside of the checkbox, instead of to the left. Anyone know what's causing this? Edit: couldn't find a site to host the image, so I removed it.

Share this post


Link to post
Share on other sites
Quote:

HWND CreateWindowEx(

DWORD dwExstyle,
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwstyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);

Probably because in the call that you've posted x > nWidth.

Share this post


Link to post
Share on other sites
The x coordinate is the coordinate of the left edge of the checkbox control relative to the parent window's client area. The nWidth value is a width which is offset from the left edge to yield the right edge's coordinate. There is no reason why your x coordinate shouldn't be greater than the width of the checkbox.

As the OP already discovered, the problem is that the total width of the control being created is too small. The x coordinate is in no way involved.

Share this post


Link to post
Share on other sites

This topic is 4095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this