Thread: ListBox: Everything is alphabetized, How to change this to just add to the bottom?

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    ListBox: Everything is alphabetized, How to change this to just add to the bottom?

    Ok, I have a list box, and i've been considering converting to a Listview, but for temporary purposes, how do I get my listbox to not be alphabetized? I have it as a log window and it dumps a TON of data into this listbox, at first, I thought it was an error because it dumps thousands of entries into this window, but even after using a Sleep(10) before each SendDlgItemMessage() It was still happening. And it wasn't until I put integers in front of my messages that I noticed it was putting everything in alphabetical order based off of the first letter/number. Any way to change this so all the new stuff goes below the last entry?

    Code:
    switch(Opcode)
    {
    case 0xA9: //LDA imm
    CPU.P+=2; //two byte instruction
    wsprintf(buf, "You need to implement opcode: %#X", Opcode);
    index=SendDlgItemMessage(hwnd,IDC_LIST1, LB_ADDSTRING,0,(LPARAM)buf);
    SendDlgItemMessage(hwnd, IDC_LIST1, LB_SETITEMDATA, (WPARAM)index, (LPARAM)ListIdNum);
    ListIdNum++;
    break;
    I thought that the LB_SETITEMDATA helped keep track of this but apparently not. Anyone? It does the same if its this too:


    Code:
    CPU.P+=2; //two byte instruction
    wsprintf(buf, "You need to implement opcode: %#X", Opcode);
    SendDlgItemMessage(hwnd,IDC_LIST1, LB_ADDSTRING,0,(LPARAM)buf);
    break;

    My ListBox code is done as a resource through Visual Studio. My program is dialog based as well.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Remove LBS_SORT style.
    If you have a dialog resource, just set Sort to false for the listbox.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    20
    I looked through the properties for something like that before, but hopefully I missed it, Thanks! I'll try this when I get home.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  2. adding a function to a program
    By trippedwire in forum C++ Programming
    Replies: 9
    Last Post: 09-30-2004, 12:35 PM
  3. How to cast a ListBox item to an int for a switch statment?
    By Swaine777 in forum C++ Programming
    Replies: 8
    Last Post: 09-26-2004, 08:52 PM
  4. help with calculating change from a dollar
    By z.tron in forum C++ Programming
    Replies: 3
    Last Post: 09-13-2002, 03:58 PM
  5. Replies: 2
    Last Post: 09-04-2001, 02:12 PM