Hi all,
I need to move a group of buttons.I tried with group box and frames but only the frame or group box is moving and not the buttons placed in it.
Plz help regarding this.
Printable View
Hi all,
I need to move a group of buttons.I tried with group box and frames but only the frame or group box is moving and not the buttons placed in it.
Plz help regarding this.
Hi!
There is no magic, you have to move each button individually.
Regards / Z
where u want to move the group of button?? at the time when application is running or in resource editor?
If it is in resource editor, u can select multple objects using the CTRL key
or draw a window around all the items to select. Then MOVE :wave:
Cheers
By the way, in resource editor (VS 6.0) it seems impossible to move controls in steps of just one pixel. They always move two pixels. That sucks :thumbd:
Is there a fix?
check it out again. they move in steps of one pixel.
Try to move by using the keyboard arrows and not by using mouseQuote:
Originally posted by zerver By the way, in resource editor (VS 6.0) it seems impossible to move controls in steps of just one pixel. They always move two pixels. That sucks
Is there a fix?
Not always. I just tried moving a checkbox three times using the right arrow key.
The first time it moved two pixels, then one, then two. :confused:
(I pasted a screenshot from the resource editor in Paint Shop Pro after each move to confirm this)
Annoyances galore. I have VS 6.0 SP5.
This is weird i also using VC6 and i didn’t face this problem; it always moves one pixel with arrow keys. :confused:Quote:
Originally Posted by zerver
PS: Unless you hold the key down of course :D
Cheers
OK, I have confirmed now that exactly every second move is two pixels long.
I also tried switching from Metric to U.S. measurement system in Regional Options but that did not help...
Hi all,
I want to move the buttons while application is running and not in resource editor.
Thank u.
get the handle of all the buttons u want to move and call MoveWindow() for each button at the event when u want to move thosse buttons
Also look at ::SetWindowPos().Quote:
Originally Posted by harshandu
Cheers
Hello,
When you add controls from resource editor, it is added on the dialog window and not in group box, though you place it in the group box. Hence moving group box does not result in moving the control.
But one can attach the group box as parent to the control you want to move together using CWnd::SetParent function. Moving group box will move the control also. Best place to set the parent is in CDialog::OnInitDialog function. There will be movement in control position when you attach another parent to it, which is the offset of the new parent with respect to the old one.
Here is a code snippet to be included in OnInitDialog function of the parent dialog class, which moves a control (ID = IDC_BUTTON) from parent dialog to a group box (ID = IDC_GROUP), retaining its original position. Once this is included in OnInitDialog function, moving the groupbox will result in moving the control as well.
Regards.Code:// Calculates offset of group box to the parent window
CRect Rect;
GetDlgItem(IDC_GROUP)->GetWindowRect(Rect);
ScreenToClient(Rect);
int X = Rect.left, Y = Rect.top;
// Sets group box as parent to the control
GetDlgItem(IDC_BUTTON)->SetParent(GetDlgItem(IDC_GROUP));
// Retains original position by offsetting control
GetDlgItem(IDC_GROUP)->GetDlgItem(IDC_BUTTON)->GetWindowRect(Rect);
GetDlgItem(IDC_GROUP)->ScreenToClient(Rect);
Rect.OffsetRect(-X, -Y);
GetDlgItem(IDC_GROUP)->GetDlgItem(IDC_BUTTON)->MoveWindow(Rect);
Pravin.
Apart from this, when I click on a button in resource editor it says in the left corner that the size is 51x14, but when I make a screen shot and measure the pixel size it is 77x23. So, I can confirm again that there is definitely something fishy about the resource editor units in VS 6.0.Quote:
Originally Posted by zerver
If someone knows what is going on, plz tell. Thx.