Page 1 of 1
setShowHorzScrollbar(false) should hide scrollbar
Posted: Thu Dec 18, 2014 09:21
by Montred
For the hiding or showing of scrollbars, most GUI's have three options:
Always show
Always hide
Auto (Show when needed).
CEGUI only has "Always show" and "Show when needed". Most times in modern guis when you are showing a list of elements what you want is to hide the horizontal scrollbars, clip content, then the user can hover over an element to show a tooltip that shows all the text that is missing. ¿Is there a way to accomplish this currently? Is not, ¿would a patch be welcome?
Re: setShowHorzScrollbar(false) should hide scrollbar
Posted: Thu Dec 18, 2014 11:23
by Kulik
Yes, patch would be welcome.
This sounds like a feature that should be relatively easy to implement.
Re: setShowHorzScrollbar(false) should hide scrollbar
Posted: Thu Dec 18, 2014 12:15
by Montred
Cool. Problem is, I'm using 0.8 but 0.8 as far as I can tell is a maintenance only branch, and something like this wouldn't be accepted because it's API-breaking, right? So what am I supposed to do in this case if I want the feature in CEGUI but I'm only interested in the stable version.
There's a similar problem with the other font fallback change I submitted, is there any ETA for 1.0 so that we can all "sync" our efforts?
Re: setShowHorzScrollbar(false) should hide scrollbar
Posted: Thu Dec 18, 2014 12:22
by Kulik
Yeah, this change will most likely break API and cannot be done on v0-8. IMO you need to introduce an enum to allow this option, change the API accordingly and apply it to default.
If you want it in v0-8 you would then cherry pick that one commit there and keep your own v0-8. The change will most likely be small enough for this to be an option.
I am sorry but this is the reality, we can't break API for people using the stable branch. No exceptions.
Re: setShowHorzScrollbar(false) should hide scrollbar
Posted: Thu Dec 18, 2014 13:03
by Ident
If you make a pull request for default branch (See:
https://bitbucket.org/cegui/cegui) you can later-on relatively easy apply the commit from default, to your v0-8 and use it (only on your computer). Basically what Kulik said.
Re: setShowHorzScrollbar(false) should hide scrollbar
Posted: Sat Dec 20, 2014 19:40
by Montred
Thanks for the replies.
I actually found a workaround for this that does exactly what I want, you simply have to hide the horizontall scroller element. It's not very elegant of course because you are relying on numeric indices but it works for me:
Code: Select all
if (scroller->getChildAtIdx(1) && scroller->getChildAtIdx(1)->getChildCount() >= 3){
scroller->getChildAtIdx(1)->getChildAtIdx(0)->setVisible(false);
scroller->getChildAtIdx(1)->getChildAtIdx(1)->setVisible(false);
scroller->getChildAtIdx(1)->getChildAtIdx(2)->setVisible(false);
scroller->getChildAtIdx(1)->setVisible(false);
}
I have one little problem though, the layout is a bit broken after I do this and things won't show properly until I nudge the window by resizing by at least a pixel, I'm sure you know what I'm talking about.
My question is, is there anyway of making that "nudge" happen programmatically? I have tried combinations of invalidate() and performChildWindowLayout(true, true) plus changing the size with setSize() and update() on all the elements involved to no avail.
performChildWindowLayout() + changing the size programatically fixes some of the layout problems. The final problem I have now is the "ghost" of the horizontal scrollbar keeps showing (only the rail, not the handle or the direction buttons) until I nudge the parent window of the element by resizing it with the mouse.
Re: setShowHorzScrollbar(false) should hide scrollbar
Posted: Sun Dec 21, 2014 11:37
by Ident
I suggest making a patch that does it right instead of messing with workarounds. Seriously. You will probably save time by doing so, and should be really easy to do it.
If you do it with some crazy workaround you will always end up working your way around other issues that arise.