Thread: Create two buttons that interact with an editbox

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    45

    Create two buttons that interact with an editbox

    Hi all I hope in an answer that could help me about my problem because I'm going crazy.
    I'm creating a GUI in Visual C++ .NET and I'd like to split the "Spin Control" in two buttons.

    I created an editbox with a spin, only to test the code, and the result is this:
    See Image1

    Here the code that I wrote:
    The spin control:
    Code:
    CSpinButtonCtrl *spin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_ROTOR_TEST);
             spin->SetRange(0, 25);
    	 spin->SetPos(0);
    GetDlgItem(IDC_ROTORTEXT)->SetWindowText("A");
    The letters in the editbox:
    Code:
    void CTestDlg::onShowposSpinStr(NMHDR* pNMHDR, LRESULT* pResult)
    {
    	int nNewPos;
    	char szNumber[][16] =
    	{ 
    		"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "W", "V", "X", "Y", "Z"
    	};
    	NM_UPDOWN *pNMUpDown = (NM_UPDOWN*) pNMHDR;
    
    	nNewPos = pNMUpDown->iPos + pNMUpDown->iDelta;
    
    	if(nNewPos >= 0 && nNewPos <= 25)
    	{
    		GetDlgItem(IDC_ROTOR3TEXT)->SetWindowText(szNumber[nNewPos]);
    	}
    	*pResult = 0;
    }
    But now I have to split the spin into two buttons that interact with the editbox, to increase/decrease the letters, like this:
    See Image2

    I have no idea on how I can do this...
    Please someone help me, I'm desperate.

  2. #2
    Registered User
    Join Date
    Jul 2005
    Posts
    45
    This morning I splitted the spin control in two buttons, here is the code:

    Code:
    void CTestDlg::OnBnClickedButtonUp()
    {
    	int rl=GetDlgItemInt(IDC_EDIT3TEXT);
    	rl=rl+1;
    	SetDlgItemInt(IDC_EDIT3TEXT,rl);
    }
    
    void CTestDlg::OnBnClickedButtonDown()
    {
    	int rl=GetDlgItemInt(IDC_EDIT3TEXT);
    	rl=rl-1;
    	SetDlgItemInt(IDC_EDIT3TEXT,rl);
    }
    But I need to display letters into the editbox not the numbers.
    Obviously I need letters from A to Z.
    Someone could help me to intergrate the code of the function that I created to display the letters in the first post and this?

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    45
    Any help?

  4. #4
    Banned
    Join Date
    Jun 2005
    Posts
    594
    should of posted in HERE

  5. #5
    Registered User
    Join Date
    Jul 2005
    Posts
    45
    Please moderators Lock or Delete this topic I moved to Windows Programming.

    Thank you!
    Last edited by Arkanos; 07-11-2005 at 02:28 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OwnerDrawn Radio Buttons?
    By Devil Panther in forum Windows Programming
    Replies: 0
    Last Post: 02-11-2006, 11:02 AM
  2. Cannot create MDI Client Win
    By JaWiB in forum Windows Programming
    Replies: 1
    Last Post: 10-31-2005, 10:05 PM
  3. Replies: 2
    Last Post: 08-25-2005, 03:09 PM
  4. Replies: 3
    Last Post: 07-23-2005, 08:00 AM
  5. Create two buttons that interact with an editbox
    By Arkanos in forum Windows Programming
    Replies: 8
    Last Post: 07-13-2005, 12:56 AM