Thread: How do I make it wait for user input

  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257

    How do I make it wait for user input

    Hey,

    I have this loop that will transfer a selected item from a listbox to an edit box. Every iteration it takes the same selected item from the list and puts it into the next edit box. I want it to wait for the user to select another item in the listbox before it copies it into the edit box. Every iteration it should wait for user input (selection). How do I do that?

    Here's what I got:
    Code:
    CString str;
    	CListBox* pGetList[512];
    	
    	for(i=0; i<10; i++)
    	{
    		pGetList[i] = (CListBox*) GetDlgItem(IDC_LIST1);
    	
    		pGetList[i]->GetText((pGetList[i]->GetCurSel()),str);
    
    		CWnd* pWnd = txtbox[i]; 
    		pWnd->SetWindowText(str);
    	}

  2. #2
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Windows is event driven. Clicking on a item in a listbox is an event. Handle the event to fill the editboxes. The event you want is LBN_SELCHANGE. Create a variable to track how many clicks have been processed instead of trying to loop 10 time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help with C program writing
    By The_PC_Gamer in forum C Programming
    Replies: 9
    Last Post: 02-12-2008, 09:12 PM
  2. For loop problems, input please.
    By xIcyx in forum C Programming
    Replies: 2
    Last Post: 04-22-2007, 03:54 AM
  3. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 01:50 PM
  4. How to make a program wait for an event?
    By DRoss in forum C++ Programming
    Replies: 0
    Last Post: 09-10-2001, 01:13 PM
  5. How can I make a program wait for an event?
    By DRoss in forum C++ Programming
    Replies: 0
    Last Post: 09-06-2001, 09:28 AM