The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: xandaz on June 24, 2010, 10:21:20 PM

Title: Radio Buitton Text doesn't show!!!
Post by: xandaz on June 24, 2010, 10:21:20 PM
   Why the hell doesnt the radiobutton's text show? This should be a pretty simple proceeding.

    inv. CreateWindowEx,NULL,addr ButtonClass,addr ButtonText,WS_VISIBLE+WS_CHILD+BS_AUTORADIOBUTTON,\
        NULL,NULL,10,10,hWnd,BtnID,hInstance,NULL
    mov hBtn,eax

    I've tried several things such as WM_SETTEXT, BS_TEXT, BS_RIGHT etc. When i choose the button, the focus rect appears shrunk around text that doesnt appear.
    Can someone help?
Title: Re: Radio Buitton Text doesn't show!!!
Post by: MichaelW on June 25, 2010, 06:44:24 AM
The only problem I can see is that the specified width is not enough to contain the text.
Title: Re: Radio Buitton Text doesn't show!!!
Post by: Ghandi on June 25, 2010, 09:53:07 AM
I agree, a 10x10 square will only just display the radio button itself, let alone any text.

HR,
Ghandi
Title: Re: Radio Buitton Text doesn't show!!!
Post by: hutch-- on June 25, 2010, 10:50:45 AM
Yep,

The window size is too small to show much else than the bare radio button circle.

NULL,NULL,10,10

Try something like you initial X-Y co-ordinates then a width of 120 pixels by about 15 pixels high. Check if the text displays correctly and make sure it does not clip off the bottom of characxters like gjpq etc ...
Title: Re: Radio Buitton Text doesn't show!!!
Post by: Tedd on June 25, 2010, 11:01:14 AM
If you're creating controls directly with CreateWindow, you'll need to take dialog-units into account (they're not 1:1 with pixels, or even the same for x or y) -- things require different sizes depending on the selected font; so even when it looks perfect on yours, it could (will) get messed up on another system. This is largely why it's much better/easier to make a dialog template and allow windows to take care of the details.

Anyway, 10x10 should be the size of the 'radio button' (in dialog units) not including the text, 10x150 should allow you enough space for most text (but once again, that's in dialog units.)
Title: Re: Radio Buitton Text doesn't show!!!
Post by: xandaz on June 25, 2010, 07:01:45 PM
   Yay! So many replies. Yeah i found that a bit later but thanks anyway.
   Ty guys