user3494614
user3494614

Reputation: 603

How to associate spincontrol to different edit box in MFC

I had a dialog box with text, edit box and spin control. Spin control's auto buddy and set buddy integer are set to True. I deleted the static text and then re-added it back . Also added one more button. But after this change spin control is not appearing. Please let me know how can I associate spin control to edit box without actually redesigning whole dialog box.

Thanks

Upvotes: 2

Views: 2848

Answers (3)

Ajit Vaze
Ajit Vaze

Reputation: 2704

In CSpinButtonCtrl class there is a function called ::SetBuddy( CWnd *pWnd ). Pass the pointer to your CEdit Class to it. It should work!!!. This function associates Editbox to the Spin Control.

More info : http://msdn.microsoft.com/en-us/library/530ec10h.aspx

Upvotes: 1

rrirower
rrirower

Reputation: 4590

Don't edit the .rc file. Simply use the resource editor to change the tab order making sure that the edit control is directly before the spin control. Using the resource editor reduces any likelihood of introducing additional errors.

Upvotes: 2

John Moses
John Moses

Reputation: 21

If you edit the .RC file (with a text editing program) you can find the line that has the IDC_SPINNER control. If you move the line of text to be the line directly after your edit box, they will become paired.

The MFC resource editor really needs a "Move Forward" / "Move Backwards" functionality...

Upvotes: 0

Related Questions