This is my simple code for creating a framewindow with an editbox under it. I suppose you can type in stuff in an editbox, subscribing an handler for it ? for things i have have typed in i want to be displayed in the framewindow with name "consoleframe". My question now is, if i want to add a scrollbar so i can scroll the content of the framewindow what is the best way to go at it? looked at some examplecodes but still could use some help. On how to create a scrollbar and set some useful properties. down below i have tried to write code for a scrollbar but runs into runtime error.. Even for writing the first line of the commented block for creating a scrollbar...
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* myRoot = wmgr.createWindow("DefaultWindow", "root");
CEGUI::System::getSingleton().setGUISheet(myRoot);
CEGUI::FrameWindow *consoleframe =(CEGUI::FrameWindow*)wmgr.createWindow("WindowsLook/FrameWindow", "consoleframe");
consoleframe->setPosition(CEGUI::Point(0.25f, 0.25f));
consoleframe->setSize(CEGUI::Size(0.2f, 0.2f));//0.5
consoleframe->setText(":: Console ::");
myRoot->addChildWindow(consoleframe);
CEGUI::Editbox *editbox = CEGUI::Editbox*)wmgr.createWindow("WindowsLook/Editbox", "editbox");
editbox->setPosition(CEGUI::Point(0.0f, 0.8f));
editbox->setSize(CEGUI::Size(1.0f, 1.0f));
consoleframe->addChildWindow(editbox);
/*
//i have seen others write createWindow("***/HorizontalScrollbar") ?
CEGUI::Scrollbar *scroll = (CEGUI::Scrollbar*)wmgr.createWindow("WindowsLook/Scrollbar", "scrollbar");
scroll->setPosition(CEGUI::Point(0.8f, 0.0f));
scroll->setSize(CEGUI::Size(1.0f, 1.0f));
scroll->setStepSize(1);
scroll->setDocumentSize(100);
scroll->setPageSize(10);
scroll->setAlwaysOnTop(true);
scroll->setScrollPosition(1.0f);
consoleframe->addChildWindow(scroll);
*/
want to create a scroolbar
Moderators: CEGUI MVP, CEGUI Team
- babbelfisken
- Just popping in
- Posts: 11
- Joined: Tue Nov 08, 2005 13:55
- lindquist
- CEGUI Team (Retired)
- Posts: 770
- Joined: Mon Jan 24, 2005 21:20
- Location: Copenhagen, Denmark
Re: want to create a scroolbar
You can use the ScrollablePane widget to do this. You'll want to pack all the content into fx a DefaultWindow and then add this to ScrollablePane.
Implementing your own scrolling routine for windows is a bit cumbersome, so using this provided widget can save you alot of time.
Implementing your own scrolling routine for windows is a bit cumbersome, so using this provided widget can save you alot of time.
- babbelfisken
- Just popping in
- Posts: 11
- Joined: Tue Nov 08, 2005 13:55
Re: want to create a scroolbar
thanx for the tip, will get on it...
Return to “Offtopic Discussion”
Who is online
Users browsing this forum: No registered users and 2 guests