Results 1 to 5 of 5

Thread: Combo text update

  1. #1

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    UK
    Posts
    40

    Combo text update

    OS Win98
    Compiler: VC6++
    Subject: Combo boxes

    Trying to insert/add a string a combo box, but failing. I don't get an error but the string isn't added. Pointers?

    Code:

    case WM_COMMAND:

    switch(wParam){

    case BS_PUSHBUTTON:
    if (SendMessage(hCombo,CB_ADDSTRING ,0,(LPARAM)"ABCDEF")!=CB_ERR)
    UpdateWindow(hCombo);
    MessageBox(hwnd,"Combo updated","",MB_OK);
    break;


    Thanks

    hmm

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    hmm.. did you draw the ComboBox in a dialog?? than you should drag the box to fit at least one item... for more info look at: http://winprog.org/tutorial/dlgfaq.html
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    UK
    Posts
    40
    Thanks Jop,

    No, I used the CreateWindowEx function to create it.

    Code:

    hCombo = CreateWindowEx(
    NULL,"COMBOBOX","Copy Disk:",
    WS_CHILD|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_AUTOHSCROLL,
    25, 20, 150, 5,hwnd, NULL, hInstance, NULL);

    I'm sure its something simple I'm missing



    hmm

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    case BS_PUSHBUTTON:

    is the id of your button really BS_PUSHBUTTON? Is the code actually called (does the message box show up)?

    Anyway, you have to set a far larger height value in your CreateWindowEx call. The height you specify there is for the extended list too.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    UK
    Posts
    40

    Thank you CornedBee!

    It was the height property that was causing the problem! Should have seen that one

    Thanks CornedBee !




    hmm

Posting Permissions

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



Click Here to Expand Forum to Full Width