want to create a scroolbar
Posted: Fri Dec 02, 2005 21:10
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);
*/
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);
*/