C++ Listbox problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: C++ Listbox problem

  1. #1
    Join Date
    Jan 2010
    Posts
    76

    C++ Listbox problem

    ok so say I have items 1-29 in my listbox. and I use sendmessage to send "1" using LB_SELECTSTRING

    it will select 10 instead of 1.

    does anyone know why it does that?

    Also would it be possible to select the index instead?

    I'm making a web IDE and stuff and I'm using the Listbox to keep track how how many lines are in a richtext box and what line you are currently on.

    it works like its suppose to but if I go up to line one and there is 10 in the list box it will select 10 instead of one. and I checked it is send one to it not 10

    *is really confused*

  2. #2
    Join Date
    Sep 2008
    Posts
    113

    Re: C++ Listbox problem

    It's hard to say without being able to see any code. Would you be able to provide the pertinent information?

  3. #3
    Join Date
    Jan 2010
    Posts
    76

    Re: C++ Listbox problem

    Code:
      int rtf_listbox_get_line;
                                      rtf_listbox_get_line=SendMessage(rtfctl,EM_LINEFROMCHAR,negative,0)+1;
                                      stringstream lbsl;
                                      lbsl << rtf_listbox_get_line;
                                      SendMessage(Line_Count,LB_SELECTSTRING,0,(LPARAM&)lbsl.str()); 
                                      //cout << "Listbox Line:"<< lbsl.str()<<endl;
    That will select the number from the listbox indicating the current line you are on in the rich text box.

    I use some other code for my rtf on key change and stuff that will add the line number to the listbox.

  4. #4
    Join Date
    Jan 2010
    Posts
    76

    Re: C++ Listbox problem

    Is it because 10 has a 1 in it and when your at line one its select 10 because of 1?

  5. #5
    Join Date
    Apr 1999
    Posts
    27,422

    Re: C++ Listbox problem

    Quote Originally Posted by Senith View Post
    Is it because 10 has a 1 in it and when your at line one its select 10 because of 1?
    You would get more help if you asked your question in the proper forum, i.e. the WinAPI forum.

    http://www.codeguru.com/forum/forumdisplay.php?f=47

    Regards,

    Paul McKenzie

  6. #6
    Join Date
    Jan 2010
    Posts
    76

    Re: C++ Listbox problem

    Quote Originally Posted by Paul McKenzie View Post
    You would get more help if you asked your question in the proper forum, i.e. the WinAPI forum.

    http://www.codeguru.com/forum/forumdisplay.php?f=47

    Regards,

    Paul McKenzie

    O ok. I will tomorrow as I'm tired right now *yawns*. I didn't know I needed to post it in the API forum though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center