hgeGUIListbox
  • bluecodebluecode August 2011
    Hi

    I'm pretty new to C++ and HGE, I've been trying to add a list box to a menu UI, but keep getting errors trying to add items to the list.

    Using the standard .h and .cpp from tutorial 6:
    1
    hgeGUI				*gui_options;
    1
    2
    3
    4
    5
    6
    gui_options=new hgeGUI();
    gui_options->AddCtrl(new hgeGUIMenuItem(1,fnt,snd,400,360,0.0f,"Back"));
    gui_options->AddCtrl(new hgeGUIListbox(111, 10, 40, 600, 300, fnt, 0xFF1F0000, 0xFF1F1F1F, 0xFF5F5F5F));
    gui_options->hgeGUIListbox::AddItem("sample");
    gui_options->SetNavMode(HGEGUI_UPDOWN | HGEGUI_CYCLED);
    gui_options->SetCursor(spr);


    MSVC++ 2010 gives me these errors:
    1
    'hgeGUIListbox' : is not a member of 'hgeGUI'

    and
    1
    2
    'hgeGUIListbox::AddItem' : cannot convert 'this' pointer from 'hgeGUI' to 'hgeGUIListbox &'
    1> Reason: cannot convert from 'hgeGUI' to 'hgeGUIListbox'


    I tried making a copy of the .h and .cpp files from tutorial 6 and changing "class hgeGUIMenuItem : public hgeGUIObject" to "class hgeGUIListbox : public hgeGUIObject" but this didn't help.

    Any help would be appreciated, thank you.
  • ProfEclipseProfEclipse August 2011
    1
    2
    3
    gui_options->AddCtrl(new hgeGUIListbox(111, 10, 40, 600, 300, fnt, 0xFF1F0000, 0xFF1F1F1F, 0xFF5F5F5F));
    hgeGUIListbox *lb = (hgeGUIListBox*)gui_options->GetCttrl(111);
    lb->AddItem("sample");
  • bluecodebluecode August 2011
    Thanks for your help.

    When I add those lines I get the error:
    1
    Error: identifier "hgeGUIListBox" is undefined


    Any ideas what to try next?
  • ProfEclipseProfEclipse August 2011
    bluecode said:

    Thanks for your help.

    When I add those lines I get the error:

    1
    Error: identifier "hgeGUIListBox" is undefined


    Any ideas what to try next?

    That was a typo. It should be "hgeGUIListbox" (no capital B)
  • bluecodebluecode August 2011
    Thanks ProfEclipse, got it working now.

    Also, there's a typo in GetCtrl, only one 't' not two, but spotted that one myself.

Howdy, Stranger!

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

Sign In Apply for Membership

In this Discussion

Who's Online (1)