Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

position problem 1

Status
Not open for further replies.

bubak

Programmer
Jun 25, 2001
208
SK
I have 5 radio buttons
() radio1
() radio2
......
When I do:
CButton *color;
CRect r;

GetDlgItem(IDC_RADIO1)->GetWindowRect(r);
color=new CButton();
color->Create(NULL,WS_VISIBLE|WS_CHILD|BS_FLAT,r,this,1230);

an button apperas, but on the position of IDC_RADIO2 and not IDC_RADIO1, why could that be?
 
The button is not drawned over IDC_RADIO2 it is drawned only below the IDC_RADIO1. You can verify this by moving away the Button2 on the dialog

It seems that the creator of the button cannot draw on the Radio buitton and draws it under.

Now, the radio button is always created by the framework with the BS_AUTORADIOBUTTON style.

I tried also adding the stiles WS_OVERLAPPED, WS_CLIPCHILDREN to the new button it doesn't seem to work.

But if you put before the Create statement the line:
r.DeflateRect(0,-10,0,0);
you will see that it will draw over.

Hope this helps somehow, s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
OK. U know, I just needed to do create other buttons left from the radio buttons . So there will be 5 pairs. And so I've made getWindowRect, then decreased left and rigth, and I've been suprised by that, the new ones buttons were on button under the old one :
(o)
[ ] (o)
[ ] (o)
[ ] (o)
[ ] (o)
[ ]

And I didn't know why. so i've made top-=20 and bottom -=20 for the new buttons and it's ok
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top