how is a spin button control connected to a buddy edit control

Hello!

I have this piece of code below and the code works fine.
I have one question that I can't understand how is the spin control field 
here called IDC_SPIN1
connected to the buddy edit control which actually display the value from 
the spin control.
I have looked everyway but I can't see where the connection is made.
The buddy edit control field is called IDC_BUDDY_SPIN1

I would understand all the code if the last line instead had this row 
"SetDlgItemText(IDC_BUDDY_SPIN1, strValue);"
but now it hasn't so hopefully somebody might explain how the spin control 
field is connected to the buddy edit control field .

void CEx06bDialog::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* 
pScrollBar)
{
    if (nSBCode == SB_ENDSCROLL)
    {
        return; // Reject spurious messages
    }

    // Process scroll messages from IDC_SPIN1 only
    if (pScrollBar->GetDlgCtrlID() == IDC_SPIN1)
   {
        CString strValue;
        strValue.Format("%3.1f", (double) nPos / 10.0);
        ((CSpinButtonCtrl*) 
pScrollBar)->GetBuddy()->SetWindowText(strValue);
    }
}

//Tony 


0
11/5/2005 11:09:56 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
657 Views

Similar Articles

[PageSpeed] 32

Tony Johansson wrote:
> Hello!
> 
> I have this piece of code below and the code works fine.
> I have one question that I can't understand how is the spin control field 
> here called IDC_SPIN1
> connected to the buddy edit control which actually display the value from 
> the spin control.
> I have looked everyway but I can't see where the connection is made.
> The buddy edit control field is called IDC_BUDDY_SPIN1
> 
> I would understand all the code if the last line instead had this row 
> "SetDlgItemText(IDC_BUDDY_SPIN1, strValue);"
> but now it hasn't so hopefully somebody might explain how the spin control 
> field is connected to the buddy edit control field .

The relationship between the spin control and the buddy edit control is 
in the control properties.  The edit control ID or tab order (I forget 
which) is required to be one less than the spin control's.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
11/6/2005 12:27:02 AM
It's the tab order, the spin control must come directly after the
corresponding edit control.

Cheers
Peer

0
pschneid1 (2)
11/6/2005 5:50:13 PM
Reply:

Similar Artilces:

Align Radio Button text and button
How do you get the text to line up with the button when it is small text? I have a button: <asp:RadioButton id="rdbClients" GroupName="SetupDisplay" style=" font-size: 11px " runat="server" /> If the button is the default size where the text is large, it lines up so the button is at the middle of the text. But when you change the text to a small font, it is still positioned in the same place but since the text is smaller, the button is now aligned with the top of the text because the text is now shorter. Is there a way to get...

A spin on the old TRANSPOSE question
A "search" turns up dozens of repetitions of the same question: "How d I convert a column of data into a row of data?" Easy: Copy, Past Special, Transpose. But how about for a column of repeating data? E.g.: A B C D A B C D A B C D and so on, to be converted to: A B C D A B C D A B C D, continuing. I recorded a quick macro to copy and paste special (transpose), but i kept recopying the original copied data. Manually copying and pastin is going to take way too long. Is there a formulaic method of doin this? Thanks!: ----------------------------------------------- ...

cell +1 with one button?
HI! I need to know how to add '1' to a cell using only one button. Meaning value WAS 3 and becomes 4. Is there a way to do this? It is for live stats in a sports game, s� speed is of the essense. That is why it has to be a "1-button operation." Thanks in advance! ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ Attach this macro to the button: Public Sub Add1() With ActiveCell If IsEmpty(.Value) Or IsNumeric(.Value) Then _...

Rename ActiveX control #2
Hi, I have an old ActiveX control that has been modified significantly for one of my applications. Unfortunately, another application that uses the ActiveX cannot be recompiled to use the modified ActiveX control and want to rename the modified control which my application will use. I remember years back that there were steps to do this. Does anyone know the steps to do this or where I can find them? This might help you get started: http://www.developer.com/net/vb/article.php/10926_1539541_4 Tom "Tom" <Tom@discussions.microsoft.com> wrote in message news:535DF161-5...

How many computers can I install ms office ultimate 07 edition?
How many computers can you use it for? On Wed, 14 Apr 2010 16:12:01 -0700, palmer_89 wrote: > How many computers can you use it for? Here are some general suggestions for you - your License Terms provide the details you need. I am using Office 2007 as an example In your 2007 version - click on Office Button - Options - Resources - About - View the Microsoft Software License Terms Normally the License terms includes sections for Retail License Terms, OEM License Terms and Media-Less License Terms (In Office 2010 - Product Key Card - PKC will replace Media-Less or MLK) ...

How to handle KeyPress event of a activex control?
add KeyPress event to my control: OcxTest.odl: [id(DISPID_KEYPRESS)] void KeyPress(short* KeyAscii); OcxTestCtl.cpp: EVENT_STOCK_KEYPRESS() but howto use in my web page? these are my codes below, but it dose't work! /////////////////////////////////////////////////// <objecc id="..." ...... onkeypress="OnKeyPress()"> <SCRIPT LANGUAGE="JavaScript"> function SetFlag() { alert("OnKeyPress"); } </SCRIPT> ...

I need help with windows xp home edition.
I currently have windows 7 prof. installed but I would like to reboot and install windows xp home edition instead. ( for my own reasons ) I have the windows xp home edition disk but when I reboot with it in my dvd drive it just freezes. When I am running windows 7 and I put the disk in, it won't let me click on install windows xp. If someone can help me, I would greatly appreciate it. Thanks you had best check and see if you can locate all the drivers for all your hardware, using XP, if the pc was supplied with 7, you may be out of luck trying to get hardware drivers. &q...

Connection with Mailgate Broken?
We have an office in Russia trying to send us email. They are receiving the following alert message: Message delivery to 'user@ourdomain.com' delayed SMTP module (domain@ourdomain.com) reports: connection with mailgate.ourdomain.com is broken During the time that they were trying to email us, we were receiving mail from other legitimate sources (and of course the usual spam intake). Can anyone explain this message please? TIA Phil Ask somebody over there to do telnet mailgate.ourdomain.com 25 If that is successfull as them to point Outlook Express to mailgate.ourdomain.com a...

Need Graphic For Button
Group, I am looking for a source for a graphic to use on a button. I would like to find a small red checkmark that I can put on a small button. Does anyone know of a source where I can find one? I am willing to pay for it if there isn't a free one available. Thanks so much, BobV Bob, A neat trick I've used for years is to use text. In the button caption... hold the Alt key and type 0052 on the num pad Change the font for the button to Dixieland. This will give you a checkmark on your button. Use the font size to adjust, and color to suit...

DVD drive spinning up
How can I prevent the DVD drive pinning up each time when NOT in use?? In configuration I have already disabled all auto run options! Or is the only remedy taking out the disk each time? -- regards, |\ /| | \/ |@rk \../ \/os On 5/28/2010 10:17 AM, Linea Recta wrote: > How can I prevent the DVD drive pinning up each time when NOT in use?? > In configuration I have already disabled all auto run options! > Or is the only remedy taking out the disk each time? Well it spins up even without a disc in the drive actually. It is just quieter and it realizes pret...

unavailable / faded grey buttons
I've had MC Outlook 2003 for 2 weeks. All working fine until today. The following buttons are faded and not accessible New Mail Message; reply; reply all; forward. Plus I cannot access Toolbar (within View) or Customise (within Tools) either. Can anyone help? Thanks in advance. Do you have an active email account? If you do then try deleting outcmd.dat.dat and restart outlook. -- Bill Rodgers MVP "fistral" <fistral@discussions.microsoft.com> wrote in message news:A63847D3-F9B8-4911-BEB0-67DBE66B99C4@microsoft.com... > I've had MC Outlook 2003 for 2 weeks. All w...

Edit options in the forms tool bar un-usable
I have an employee here that is excel-savvy but can't understand why she can't use the edit options in the forms toolbar. (nor can I)These consist of the "Edit Box", "Combination List-Edit", "Combination drop-down edit", and "Edit Code" tools. Can anyone explain this to me or tell me how to make them available? They're there, they just aren't usable. I was thinking that she has to be in a certain mode but I just don't know. It's to be compatible with excel 5 files, with files created with 97 and later they are not avai...

Odd border around Edit Box
VC++ 6.00 (MS Developer Studio) I created some simple edit boxes but wanted to change the background color to white so I overrode OnCtlColor with this code: if (pWnd->GetDlgCtrlID() == IDC_OUTPUT_STRIP) { // Set color to Black on White pDC->SetTextColor(RGB(0,0,0)); pDC->SetBkColor(RGB(255, 255, 255)); which did have the desired coloring effect but has an odd artifact of putting a black border around the edit box: http://www.griffobros.com/EditBox1.jpg The first box was created with Class Wizard and has only the 'Border' box checked. I've dink...

Contact Edit
Windows 7, I bring up the Edit Contact window but can not change the email address. How do I do That? Earl After you click Edit Contact, are you clicking Contact at the left? -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "Earl Partridge" <earlp@pearnet.com> wrote in message news:OooAtvzqKHA.6064@TK2MSFTNGP02.phx.gbl... > Windows 7, I bring up the Edit Contact window but can not change the > email address. How do I do That? > Earl > When you open the main "Edit Contact" window, you still have to sele...

Disable Plus Button
Is there any way that I can disable the plus button in Store Operations POS? Reason: Apparently the cashier will sometimes hit the plus button instead of the OK button then hit the OK button and not notice the last item being doubled up....if the customer is then paying by credit card they don't check the amount being charged and the transaction goes through. Well ...what I ended up doing was creating a COM addin which was essentially a small borderless form with a background picture of the plus button. This was positioned over the real plus button and when pressed displays a mes...

Close button on tabs
I have a tab control with icons + labels. I want to include a little 'x' on the top-right corner of each tab (a close button). I suspect I'm going to need to create a custom control. My question is: Is is possible to subclass or somehow utilize CTabCtrl so that I don't have to recreate the entire control form a CWnd or CStatic control? If so, how? Thank you all. You can owner-draw the CTabCtrl. Here is a sample. http://www.codeguru.com/Cpp/controls/controls/tabcontrols/article.php/c2237 You could draw the "X" in the DrawItem() code. -SM On Sep 9, 2:56=A0am, Se...

SMTP error. Connection refused
Hi, One of our finance packages sends out electronic receipts automatically. In the setup for this package I have added the Exchange 2003 server's IP address and the logon information. (I've even used the Administrator account to see if that would help.) Under "Default SMTP server" on the Relay tab I have added the IP address of the server running the Finance package. Each time the package tries to send a message the following appears in the log. ----------- Started: 21/09/2006 9:38:09 AM Abnormal Termination: Error - Socket Error # 10061 Connection refused. ----------...

"Map" button
Does the "Map" button exist in 2003 EXCELL Hi no, MS has disconitnued this support with Excel 2002 -- Regards Frank Kabel Frankfurt, Germany "NLeites" <NLeites@discussions.microsoft.com> schrieb im Newsbeitrag news:A47AFEDE-097D-4BDC-B1F5-CD902D880C95@microsoft.com... > Does the "Map" button exist in 2003 EXCELL You must now purchase MapPoint program which interfaces with Office apps. Gord Dibben Excel MVP On Thu, 11 Nov 2004 23:19:40 +0100, "Frank Kabel" <frank.kabel@freenet.de> wrote: >Hi >no, MS has disconitnued this suppo...

Reports error Not associated with a trusted SQL Server connection
Hi, When logged on to the crm server as admin I can run the User Summary report fine. However when I log on to the web client as a user who has system adminstrator role I get the following: An error has occurred during report precessing. Cannot create a conntection to data source CRM. Login failed for user. Reason: Not associated with a trusted SQL Server connection. I followed instructions suggested in this newsgroup and went into Report Manager and entered the credentials of the administrator and selected use as Windows credentials and impersonate the user and all now works but I...

Cannot use copy record button on form with lookup box
Hi. I posted the following message on 12/01/09 but did not get any replies. I am unsure if it is an unanswerable question or not... Hi. I have two forms that I would like to add a copy record button to. But I get error messages [Run-time error 3414] when I try. It points to this line of code when I click debug: If Not rs.EOF Then Me.Bookmark = rs.Bookmark After troubleshooting for a bit, I realized that both forms have lookup boxes in the form header section. If I delete the lookup box from the form I can add a duplicate record button without a problem. Is there anyway t...

How to disable CSpinButtonCtrl button
Hi, I just came across a piece of my old MFC code that I want to improve: A CSpinButtonCtrl is used to let the user browse through some database result sets. What I want to achieve is: When the first result is displayed, the left-arrow button of the CSpinButtonCtrl shall be disabled and when the user reaches the last result right-arrow button shall be disabled. I'm wondering what the easiest way to disable one of the two buttons is? Thanks, Guido ...

Button Icon graphics in Vista
The following works in WinXp (VS2002 IDE): CButton m_ButtonName; .... BOOL CMyDlg::OnInitDialog() { .... m_ButtonName.SetIcon (AfxGetApp()->LoadIcon(IDI_IconName)); .... } The "Icon" property in visual studio is set true for the button. There is no manifest file for the exe. But the above doesn't work in Vista. Specifically the icon graphics is missing/not showing. Also the button looks to be system drawn (vertical shading). Any ideas? Thanks... > CButton m_ButtonName; >... >BOOL CMyDlg::OnInitDialog() >{ >... > m_ButtonName.SetIcon (AfxGetApp...

Outlook 2000 'Accounts' Internet Connect Not Working
Hello, I recently must have deleted a file imperative for Outlook to connect to the internet to pull my emails down. Outlook Express works just fine. However, I have moved 2 times and have misplaced my upgrade disc. When I try and run and detect & repair, it requires my disc - which I don't have. Any suggestions? Again, Outlook Express works just fine, but I want to have everything in Outlook. I have looked at upgrading to Outlook 2003, but it requires a new Windows program as well...any help is greatly appreciated!!!! ...

public folders connectivity
why are our outlook clients sometimes connecting to an XC server at the other end of the world for public folders connectivity? this even though there is no PF content on that server that we use there is also no PF replication going on between those 2 servers each continent has it's own set of public folders that they do not (yet) share with the other continent thnx ...

Spin Off
Hey, I've entered the spinoff data for Medco Health solutions from Merck and Money 2000 running under Windows 2000 ME responds with "This operation cannot be performed" after the last piece of data is entered. A microsoft human suggested the data I'm entering must be bad. Thanks for looking at this, Anxious in Asheville I always hate having to send people down this path, but I fear you are a good candidate to read: http://www.bollar.org/msmoney/#Q104. Good luck. <chernobog@charter.net> wrote in message news:04f501c3b946$d9cb3b50$a401280a@phx.gbl... > I'...