IGUIScrollBar problem

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Guest

IGUIScrollBar problem

Post by Guest »

Hi, Im currently trying to develop a game utilizing the Irrlicht engine. I am still in the initial programming phases where I am creating my own menu system. The problem I have run into is one of understanding the class irr::gui::IGUIScrollBar. Within this class there are member functions for getting the absolute and relative position that are inherited from the IGUIElement class. I am trying to set a default position for the scroll bar rectangle (the interactive part, excuse me for not having a better term). It is important to understand that I do not want to simply set the position of the whole scroll bar, rather I would like to have the user be able save his/her settings so that the scroll bar rectangle is always at that position whenever they play their game. I think this problem could be cleared up if I knew exactly what the functions: IGUIScrollBar->setRelativePosition() and IGUIScrollBar->setAbsolutePosition() do and why they are different.

Id like to ask for your help on this, as I have tried researching this by looking at the header files and on the API.NET with no success. If you have any suggestions, comments, etc. please feel free to email me or post here. You can reach me at: meyemh30@yahoo.com
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

these might help.

gui::IGUIScrollBar* scrollbar = env->addScrollBar(0,rect<s32>(0,0,10,10));
//for this example first param = bool Horizontal, Rectangle.

scrollbar->setMax(255); //max number of scrollbar positions
s32 userpos = 3; //or another variable
scrollbar->setPos(userpos); //sets the position of the scrollbar


This is different for listboxes thats another headache.
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

Just one question, are you talking about the position of the entire scroll bar ( the up and down buttons, the little square etc) or are you refering to just the square that determines the current value of the scroll bar?

The set relative and set absolute position affect the position of the entire scrollbar on the screen. To set the value of the bar, and hence the position of just the rectangle use the setpos function from Midnights example.
White Lotus
Posts: 2
Joined: Thu Sep 08, 2005 11:29 pm

Post by White Lotus »

Yes, I am actually referring to the position of the rectangle inside the scroll bar ( not the up and down arrows, the other one! ) I will give this a try... Thank you!
Post Reply