Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Combobox on toolbar

I want to create a toolbar with a combobox on it. But in MSDN there's only a TBSTYLE_DROPDOWN button style. I suppose that it could be done with owner drawn button, but I didn't found out how can I create it.

[blue]Oxygenium[/blue]

Comments

  • chick80chick80 Posts: 349Member
    Why don't you use a rebar that contains the combobox and the toolbar? It's an easiest way to do it (owner drawn buttons give lots of problems...).

    nICO

    [hr]
    [italic]How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • oxygeniumoxygenium Posts: 52Member
    : Why don't you use a rebar that contains the combobox and the toolbar? It's an easiest way to do it (owner drawn buttons give lots of problems...).
    :
    : nICO
    :
    : [hr]
    : [italic]How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :
    :

    Yeah... I decided to do so too. But I'm having problems with creating theese bars in rebar. I'm doing it just like in the example in the documentation, but it doesn't work!

    [code]
    /*
    fce: createToolbars

    popis: Vytvori rebar s toolbarem a comboboxem
    */
    HWND createToolbars (HWND hWnd)
    {
    //vytvorim rebar
    HWND rebar = CreateWindowEx (
    WS_EX_TOOLWINDOW,
    TOOLBARCLASSNAME,
    NULL,
    WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
    | RBS_VARHEIGHT,
    0, 0, 0, 0,
    hWnd,
    (HMENU)IDC_REBAR,
    hInstance,
    NULL
    );

    REBARINFO ri;
    ri.cbSize = sizeof (ri);
    ri.fMask = 0;
    ri.himl = NULL;

    SendMessage (rebar, RB_SETBARINFO, 0, (LPARAM)&ri);

    //pridam toolbar a combobox
    REBARBANDINFO rbi;

    rbi.cbSize = sizeof (rbi);
    rbi.fMask = RBBIM_STYLE | RBBIM_CHILD;

    //toolbar
    rbi.hwndChild = createTopToolbar (rebar);
    rbi.cyMaxChild = 500;
    rbi.cyMinChild = 100;
    rbi.cyChild = 200;
    rbi.cx = 200;

    if (!SendMessage (rebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbi))
    MessageBeep (0);
    return rebar;
    }
    [/code]

    I don't have even an idea what's wrong (of course that you'll look at it and see a huge mistake :). At least I hope so...).

    [blue]Oxygenium[/blue]
  • chick80chick80 Posts: 349Member
    The code seems right, but I doubt you could create a rebar if you specify TOOLBARCLASSNAME as the window class... ;) REBARCLASSNAME should work!

    nICO

    [hr]
    [italic]How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • oxygeniumoxygenium Posts: 52Member
    : The code seems right, but I doubt you could create a rebar if you specify TOOLBARCLASSNAME as the window class... ;) REBARCLASSNAME should work!
    :
    : nICO
    :
    : [hr]
    : [italic]How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :
    :

    Oopps.. o_O I had to be very tired yesterday... :-) Thanks...

    [blue]Oxygenium[/blue]
Sign In or Register to comment.