CGUITextBox, scrolling, static text.
The link works for me, alternatively you can use
http://www.pltg-blacksun.de/yass/downloads/TextBox.rar
which is a more direct download link.
http://www.pltg-blacksun.de/yass/downloads/TextBox.rar
which is a more direct download link.
YASS - Yet another Space Shooter
under Devolpment, see http://yass-engine.de
under Devolpment, see http://yass-engine.de
gui::IGUIElement::IGUIElement' : no overloaded function takes 4 arguments
this what it writes for error for this
"CGUITextBox::CGUITextBox(irr::gui::IGUIFont * font, const wchar_t * text,
IGUIEnvironment* environment, core::rect<s32> rectangle,
IGUIElement* parent, s32 id)
: IGUIElement(environment, parent, id, rectangle)
{..."
Whats the prob?
this what it writes for error for this
"CGUITextBox::CGUITextBox(irr::gui::IGUIFont * font, const wchar_t * text,
IGUIEnvironment* environment, core::rect<s32> rectangle,
IGUIElement* parent, s32 id)
: IGUIElement(environment, parent, id, rectangle)
{..."
Whats the prob?
If you want to scroll the text in the CGUITextBox with your mouse wheel, just add this code in the bool CGUITextBox::OnEvent(SEvent event) of CGUITextBox.cpp.
This code comes from CGUIListBox.cpp.
[/b]
This code comes from CGUIListBox.cpp.
Code: Select all
switch(event.EventType)
{
case EET_MOUSE_INPUT_EVENT:
{
switch(event.MouseInput.Event)
{
case EMIE_MOUSE_WHEEL:
m_pScrollbar->setPos(m_pScrollbar->getPos() + (s32)event.MouseInput.Wheel*-10);
irr::s32 line = m_pScrollbar->getPos();
setVisibleText(line);
return true;
}
}
break;
}
I have the same problem, how to do ?
from sivagiriCode: Select all
gui::IGUIElement::IGUIElement' : no overloaded function takes 4 arguments this what it writes for error for this Embarassed "CGUITextBox::CGUITextBox(irr::gui::IGUIFont * font, const wchar_t * text, IGUIEnvironment* environment, core::rect<s32> rectangle, IGUIElement* parent, s32 id) : IGUIElement(environment, parent, id, rectangle) {..." Whats the prob?
I'm sorry to respond that late, but I lost a bit of the sight to this topic.
The problem is that between Irrlicht 0.11 and 0.12, the API of IGUIElement changed, and I forgot to update the resource on my server.
In 0.12, there is a added first Parameter of the constructor of IGUIElement: EGUI_ELEMENT_TYPE type which needs to be set to EGUIET_ELEMENT because this is a custom Element.
I've updated the resource -> here and also added the very useful Mousewheel scrolling feature, posted by julindien, thanks to you.
Currently the Irrlicht wiki is down, I will update the code there as soon as I see it online again.
The problem is that between Irrlicht 0.11 and 0.12, the API of IGUIElement changed, and I forgot to update the resource on my server.
In 0.12, there is a added first Parameter of the constructor of IGUIElement: EGUI_ELEMENT_TYPE type which needs to be set to EGUIET_ELEMENT because this is a custom Element.
I've updated the resource -> here and also added the very useful Mousewheel scrolling feature, posted by julindien, thanks to you.
Currently the Irrlicht wiki is down, I will update the code there as soon as I see it online again.
YASS - Yet another Space Shooter
under Devolpment, see http://yass-engine.de
under Devolpment, see http://yass-engine.de
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
I just got it working with 1.4.
Here's what I did.
First, the method declaration for OnEvent didn't match what was in IEventReceiver, so it wasn't even getting called. It should be
not
After making that change in the .h and .cpp, the box started receiving events, but the text still wouldn't scroll. There's some kind of problem in the event handler. I've spent a few days trying to understand Irrlicht's event handler, and much of it still eludes me. What I *think* is happening here is that the first "if" block which handles scroll wheel events is generating a new GUI scrollbar event (or corrupting the current event?) when it does its setPos on the scrollbar. Then the second "if" block picks up that event and tries to do... something....
Anyway, I fixed it by putting an between the two "if" blocks to ensure that a single pass through OnEvent either handles the mouse event or the GUI event, but not both.
It works now!
I have a couple of questions too.
In the demo program, since the box is created with "new" should it not be dropped explicitly someplace too?
Is it possible to make this box work with IGUIEnvironment->addGUIElement(), and if so, what would that look like? I'm still quite new to Irrlicht and C++.
Thank you everybody for this code!
EDIT:
Whoops. My "else" didn't completely fix it. As soon as the parent received an event, the text scrolling broke again and couldn't be fixed. A better solution is to have each "if" block return "true" as soon as they handle the event, and have OnEvent return "false" at the bottom if it doesn't actually handle an event. I still don't have this working completely right with respect to parent events. The heirarchy of event handling still confuses me.
Here's what I did.
First, the method declaration for OnEvent didn't match what was in IEventReceiver, so it wasn't even getting called. It should be
Code: Select all
OnEvent(const SEvent& event)
Code: Select all
OnEvent(SEvent event)
Anyway, I fixed it by putting an
Code: Select all
else
It works now!
I have a couple of questions too.
In the demo program, since the box is created with "new" should it not be dropped explicitly someplace too?
Is it possible to make this box work with IGUIEnvironment->addGUIElement(), and if so, what would that look like? I'm still quite new to Irrlicht and C++.
Thank you everybody for this code!
EDIT:
Whoops. My "else" didn't completely fix it. As soon as the parent received an event, the text scrolling broke again and couldn't be fixed. A better solution is to have each "if" block return "true" as soon as they handle the event, and have OnEvent return "false" at the bottom if it doesn't actually handle an event. I still don't have this working completely right with respect to parent events. The heirarchy of event handling still confuses me.
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
-
- Posts: 81
- Joined: Sun Sep 09, 2007 7:01 pm
- Location: BW, Germany
anyone know how to make this scroll to the bottom of the textbox?
Ive created a function that basically does the same as setVisibleText but dont know how to change it so it sets the position of the scroll bar to the bottom of the text box. Thought you might do it with the height of the scrollbar control but to no avail
Ive created a function that basically does the same as setVisibleText but dont know how to change it so it sets the position of the scroll bar to the bottom of the text box. Thought you might do it with the height of the scrollbar control but to no avail