Hello.
I saw an example of how to use a Combobox and ListboxTextItem.
A piece of the code:
CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem( "Disabled", 1 );
combobox->addItem( item );
item = new CEGUI::ListboxTextItem( "Bottom", 2 );
combobox->addItem( item );
item = new CEGUI::ListboxTextItem( "All", 3 );
combobox->addItem( item );
But when I do this, I get this error:
no matching function for call to ‘CEGUI::Combobox::addItem(CEGUI::ListboxTextItem*&)’
/usr/include/CEGUI/elements/CEGUICombobox.h:573: nota: os candidatos são: void CEGUI::Combobox::addItem(CEGUI::ListboxItem*)
(I used the same code)
What can be wrong?
ListboxItem or ListboxTextItem?
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 15
- Joined: Thu Nov 06, 2008 18:44
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Hi,
You're likely going to have to post much more of your actual code.
The code posted looks ok, the error could be a number of things. Are you correctly including the required headers (especially "elements/CEGUIListboxTextItem.h")? If it's not that, you'll definitely have to post a minimal - but complete - example of code that exhibits the issue (since it's a programmer error, not a CEGUI issue - but we're willing to help where possible).
CE.
You're likely going to have to post much more of your actual code.
The code posted looks ok, the error could be a number of things. Are you correctly including the required headers (especially "elements/CEGUIListboxTextItem.h")? If it's not that, you'll definitely have to post a minimal - but complete - example of code that exhibits the issue (since it's a programmer error, not a CEGUI issue - but we're willing to help where possible).
CE.
-
- Just popping in
- Posts: 15
- Joined: Thu Nov 06, 2008 18:44
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
-
- Just popping in
- Posts: 15
- Joined: Thu Nov 06, 2008 18:44
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
This is why I asked if the correct header was included, and if so, to see a full (but as small as possible) example of some code that demonstrates the issue.
Currently you have basically just repeated the error that you are receiving, and this is not enough information to diagnose the problem. You must provide as much information as possible.
Please re-read the announcement post Forum Usage Guidelines: Ensure you have read this!; so far you seen to have done the exact opposite to most of these guidelines
CE.
Currently you have basically just repeated the error that you are receiving, and this is not enough information to diagnose the problem. You must provide as much information as possible.
Please re-read the announcement post Forum Usage Guidelines: Ensure you have read this!; so far you seen to have done the exact opposite to most of these guidelines
CE.
-
- Just popping in
- Posts: 15
- Joined: Thu Nov 06, 2008 18:44
-
- Just popping in
- Posts: 15
- Joined: Thu Nov 06, 2008 18:44
The code:
bool
MenuInput::ConfigurationsButton(const EventArgs& rEvent)
{
try
{
CEGUI::WindowManager* WMngr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window* WRoot = CEGUI::System::getSingleton().getGUISheet();
FrameWindow* WFrame = (FrameWindow*)WRoot->getChild("MainMenu");
WFrame->setEnabled(false);
/* Configuration Frame */
CEGUI::FrameWindow* WConfigs = (FrameWindow*)WMngr->createWindow("AquaLook/FrameWindow", "ConfigurationsMenu");
WRoot->addChildWindow(WConfigs);
WConfigs->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25f, 0), CEGUI::UDim(0.27f, 0)));
WConfigs->setSize(CEGUI::UVector2(CEGUI::UDim(0.55f, 0), CEGUI::UDim(0.55f, 0)));
WConfigs->setText("Configurations Menu");
WConfigs->setSizingEnabled(false);
/* Era pra ser Label. "Video Mode" */
CEGUI::ButtonBase* VMButton = (CEGUI::ButtonBase*)WMngr->createWindow("AquaLook/Button", "VMButton");
WConfigs->addChildWindow(VMButton);
VMButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.125f, 0), CEGUI::UDim(0.2f, 0)));
VMButton->setSize(CEGUI::UVector2(CEGUI::UDim(0.275f, 0), CEGUI::UDim(0.2f, 0)));
VMButton->setText("Video Mode");
string current;
/* Combobox Video Mode */
Combobox* vmCombo = (Combobox*)WMngr->createWindow("AquaLook/Combobox", "VMCombobox");
WConfigs->addChildWindow(vmCombo);
vmCombo->setPosition(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.2f, 0)));
vmCombo->setSize(CEGUI::UVector2(CEGUI::UDim(0.25f, 0), CEGUI::UDim(0.2f, 0)));
current = Configuration::getSingleton().Get("VideoMode");
vmCombo->setText(current);
string Resolutions[4] = {"640 x 480", "800 x 600", "1024 x 768", "1280 x 1024"};
for(int i = 0; i < 4; ++i)
vmCombo->addItem(new ListboxTextItem(Resolutions[i]));
}
catch(CEGUI::Exception e)
{
throw std::string('\n' + e.getMessage().c_str() + '\n');
}
return true;
bool
MenuInput::ConfigurationsButton(const EventArgs& rEvent)
{
try
{
CEGUI::WindowManager* WMngr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window* WRoot = CEGUI::System::getSingleton().getGUISheet();
FrameWindow* WFrame = (FrameWindow*)WRoot->getChild("MainMenu");
WFrame->setEnabled(false);
/* Configuration Frame */
CEGUI::FrameWindow* WConfigs = (FrameWindow*)WMngr->createWindow("AquaLook/FrameWindow", "ConfigurationsMenu");
WRoot->addChildWindow(WConfigs);
WConfigs->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25f, 0), CEGUI::UDim(0.27f, 0)));
WConfigs->setSize(CEGUI::UVector2(CEGUI::UDim(0.55f, 0), CEGUI::UDim(0.55f, 0)));
WConfigs->setText("Configurations Menu");
WConfigs->setSizingEnabled(false);
/* Era pra ser Label. "Video Mode" */
CEGUI::ButtonBase* VMButton = (CEGUI::ButtonBase*)WMngr->createWindow("AquaLook/Button", "VMButton");
WConfigs->addChildWindow(VMButton);
VMButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.125f, 0), CEGUI::UDim(0.2f, 0)));
VMButton->setSize(CEGUI::UVector2(CEGUI::UDim(0.275f, 0), CEGUI::UDim(0.2f, 0)));
VMButton->setText("Video Mode");
string current;
/* Combobox Video Mode */
Combobox* vmCombo = (Combobox*)WMngr->createWindow("AquaLook/Combobox", "VMCombobox");
WConfigs->addChildWindow(vmCombo);
vmCombo->setPosition(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.2f, 0)));
vmCombo->setSize(CEGUI::UVector2(CEGUI::UDim(0.25f, 0), CEGUI::UDim(0.2f, 0)));
current = Configuration::getSingleton().Get("VideoMode");
vmCombo->setText(current);
string Resolutions[4] = {"640 x 480", "800 x 600", "1024 x 768", "1280 x 1024"};
for(int i = 0; i < 4; ++i)
vmCombo->addItem(new ListboxTextItem(Resolutions[i]));
}
catch(CEGUI::Exception e)
{
throw std::string('\n' + e.getMessage().c_str() + '\n');
}
return true;
-
- Just popping in
- Posts: 15
- Joined: Thu Nov 06, 2008 18:44
And when I do this:
ListboxItem* item;
item = new ListboxTextItem("640 x 480");
item->setTextColours(colour(0.f, 0.f, 0.f));
vmCombo->addItem(item);
I get these errors:
./Source/Definitions/MenuInput.cpp:120: erro: cannot convert ‘CEGUI::ListboxTextItem*’ to ‘CEGUI::ListboxItem*’ in assignment
../Source/Definitions/MenuInput.cpp:121: erro: ‘class CEGUI::ListboxItem’ has no member named ‘setTextColours’
make: ** [Source/Definitions/MenuInput.o] Erro 1
ListboxItem* item;
item = new ListboxTextItem("640 x 480");
item->setTextColours(colour(0.f, 0.f, 0.f));
vmCombo->addItem(item);
I get these errors:
./Source/Definitions/MenuInput.cpp:120: erro: cannot convert ‘CEGUI::ListboxTextItem*’ to ‘CEGUI::ListboxItem*’ in assignment
../Source/Definitions/MenuInput.cpp:121: erro: ‘class CEGUI::ListboxItem’ has no member named ‘setTextColours’
make: ** [Source/Definitions/MenuInput.o] Erro 1
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Hi,
Thanks for posting the code. I'll deal with the easy bit first.
This is because that member function only exists in CEGUI::ListboxTextItem, to get that to work, you'd need this instead (ignoring the other issues you have):
With regards to this (and the other similar related you were/are getting):
I can't explain this. I took your code and it compiles fine here (I had to remove the 'Configuration singleton' bit obviously, but aside from that). This leaves us with possibilities that are not code related, but related to your system, tools and configuration. So...
- What system are you running (OS / platform / etc)?
- (Assuming gcc) Which version of GCC is in use?
- What, if any, options are you using with configure and also in the vars CFLAGS / CXXFLAGS / etc?
For info, I compiled it on a Intel based Apple Mac using gcc 4.0 within Xcode. No other special settings.
CE.
Thanks for posting the code. I'll deal with the easy bit first.
./Source/Definitions/MenuInput.cpp:121: erro: ‘class CEGUI::ListboxItem’ has no member named ‘setTextColours’
This is because that member function only exists in CEGUI::ListboxTextItem, to get that to work, you'd need this instead (ignoring the other issues you have):
Code: Select all
ListboxTextItem* item;
item = new ListboxTextItem("640 x 480");
item->setTextColours(colour(0.f, 0.f, 0.f));
vmCombo->addItem(item);
With regards to this (and the other similar related you were/are getting):
./Source/Definitions/MenuInput.cpp:120: erro: cannot convert ‘CEGUI::ListboxTextItem*’ to ‘CEGUI::ListboxItem*’ in assignment
I can't explain this. I took your code and it compiles fine here (I had to remove the 'Configuration singleton' bit obviously, but aside from that). This leaves us with possibilities that are not code related, but related to your system, tools and configuration. So...
- What system are you running (OS / platform / etc)?
- (Assuming gcc) Which version of GCC is in use?
- What, if any, options are you using with configure and also in the vars CFLAGS / CXXFLAGS / etc?
For info, I compiled it on a Intel based Apple Mac using gcc 4.0 within Xcode. No other special settings.
CE.
Hi there. I work at the same project as leonardoalt and found out what was causing the problem. Probably there is a bug in gcc while dealing with precompiled headers.
There are some dependencies that make compilation very slow while including it's headers, so we are using a precompiled header to speed up building, including those dependencies there.
The header CEGUI/CEGUI.h was being included via this precompiled header, too. Just taking it out of the precompiled header was enougth get rid of the error.
There are some dependencies that make compilation very slow while including it's headers, so we are using a precompiled header to speed up building, including those dependencies there.
The header CEGUI/CEGUI.h was being included via this precompiled header, too. Just taking it out of the precompiled header was enougth get rid of the error.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 2 guests