Updating the size of elements with getSkin()->setSize()

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Updating the size of elements with getSkin()->setSize()

Post by LunaRebirth »

Hi, I am trying to make it so that buttons (such as the ones attached to a droplist) and scrollbars (such as those attached to a list box) scale with the screen.

Unfortunately, env->getSkin()->setSize() only changes the size of new elements -- it doesn't update elements currently on the screen.
Also, it seems after getting a listbox's scrollbar, you cannot update it's rect (likely because the scrollbar position is relative to the EGDS_SCROLLBAR_SIZE).

If I cannot set an element's skin (without modifying Irrlicht) and I cannot update it's position, how do I ensure that, for example, a listbox's scrollbar width is scaled along with the screen's size?

In Android and iOS, listBox scrollbars are extremely small, almost invisible. env->getSkin()->setSize() works if I assume the screen never changes orientation.
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Updating the size of elements with getSkin()->setSize()

Post by LunaRebirth »

Also, it seems EGDS_WINDOW_BUTTON_WIDTH controls the width of not only an IGUIComboBox, but also the height(?) of an IGUIWindow's top highlight bar. I expected EDGS_BUTTON_WIDTH to affect the IGUIComboBox's button, but my assumption was incorrect
CuteAlien
Admin
Posts: 9680
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Updating the size of elements with getSkin()->setSize()

Post by CuteAlien »

OK, had to update my gui-element-test-code first, but you are right. Changing skin should update positions as it otherwise even messes up drawing sometimes (because the draw-calls regard new sizes while the sizes used for element creation are still using old sizes).

Also I suppose the Window bar can get it's own height constant. My guess is that the buttons were probably thought to be always quadratic (but I somehow have this nagging feeling that I've seen that specific problem discussed before - have to search forum, maybe I'm missing something...).

Too late already this night - but I'll try to change it on the weekend.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
CuteAlien
Admin
Posts: 9680
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Updating the size of elements with getSkin()->setSize()

Post by CuteAlien »

The problem with EGDS_SCROLLBAR_SIZE is fixed in svn trunk r5619.
Not yet merged with ogl-es branch, will do after I looked at the EGDS_WINDOW_BUTTON_WIDTH problem (probably tomorrow).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
CuteAlien
Admin
Posts: 9680
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Updating the size of elements with getSkin()->setSize()

Post by CuteAlien »

I made CGUIComboBox use EGDS_SCROLLBAR_SIZE instead of EGDS_WINDOW_BUTTON_WIDTH. Makes more sense for this (EGDS_WINDOW_BUTTON_WIDTH is really only useful for buttons in Window toolbar, likely tabcontrol should also be changed, thought that one might need it's own constant).
Changed in svn trunk r5620. All changes merged to svn ogl-es in r5622.

I hope it helps.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Updating the size of elements with getSkin()->setSize()

Post by LunaRebirth »

Awesome, appreciate your help
Post Reply