Turning off scrollbars for a window?

thecaptain

12-03-2008 05:46:42

Hey KungFooMasta, is there a function call that would turn off scrollbars for a window? I'm trying to make a window with components that go within a few pixels of the edge, and the scrollbars automatically kick in.

I tried setScrollPaneAccessible(false) , but I don't think it does anything, because the variable it sets (mScrollPaneAccessible) doesn't seem to be used in any if statements to change behavior.

BTW, I also fixed some more issues with TextBox disabling and some small cursor bugs. I'll have a patch soon.

thecaptain

12-03-2008 06:16:00

Oh, another thing that I'd like to fix is that the textboxes on LabelArea have their own background skin component, which isn't changable through the current interface. Is there a clean way to make the component's skin transparent? In our program we have a qgui.transparent.png component, but is there a image-independant way of doing this?

Out of curiosity, is there a reason why the LabelArea is made up of textboxes instead of just labels? It seems like the textbox might carry some unnecessary overhead...

thecaptain

12-03-2008 07:07:04

Ok, here's another set of little fixes to look over if you'd like:

http://web.mit.edu/estafl/www/sc/TextBoxFix2.patch

kungfoomasta

12-03-2008 17:32:34

I think a short while ago I decided that the ScrollPane should be a part of Panel/Window/Sheet widgets by default. Is the widgets still within window bounds when the scrollbars appear, or are you saying its outside bounds by a few pixels? (If you send me some simple code it would help me look into it pretty quickly)

As for the LabelArea using TextBoxes, I don't really remember the reasoning for it. The library is getting pretty big.. :lol:

I'll look at the patch over the next few days, when I get some time. Work is sucking up all my time these days.

thecaptain

13-03-2008 03:15:58

This is what I'm trying to do:

QuickGUI::Window* window2 = mSheet->createWindow();
window2->setDimensions(Rect(31, 103, 277, 536));
window2->setScrollPaneAccessible(false);

QuickGUI::LabelArea* chatLines = window2->createLabelArea();
chatLines->setDimensions(QuickGUI::Rect(5, 20, window2->getSize().width - 10, window2->getSize().height - 52));
chatLines->setSkinComponent("transparent");
chatLines->setVerticalAlignment(QuickGUI::Label::VA_BOTTOM);

std::stringstream ss;
ss << "a bunch of text" << std::endl << "next line" << std::endl << "third line";
chatLines->setText(ss.str());

QuickGUI::TextBox* inputBox = window2->createTextBox();
inputBox->setDimensions(QuickGUI::Rect(5, window2->getSize().height - 30, window2->getSize().width - 60, 24));
inputBox->setVerticalAnchor(QuickGUI::Widget::ANCHOR_VERTICAL_BOTTOM);
inputBox->setUseBorders(false);

QuickGUI::Button* sendButton = window2->createButton();
sendButton->setDimensions(QuickGUI::Rect(window2->getSize().width - 50, window2->getSize().height - 30, 44, 24));
sendButton->setText("Send");


I'd like to be able to just have all the widgets fit snugly in the window without a scrollbar, but I guess the scrollbar is automatically kicking in because when it appears, it covers the widgets.

About the textboxes, I can change them to labels to be a little more streamlined. Also, do you think it'd be ok if we added in a hardcoded way to set a skin to tranparent, so people wouldn't need a qgui.transparent.png? Perhaps we could just put it in setSkinComponent(x), where if x = "transparent", then it would automatically pick up on it.

Just a thought :D

thecaptain

13-03-2008 05:12:39

I think I found a quick fix :D

If you change the order of the lines in Widget::setDimensions() from
void Widget::setDimensions(const Rect& pixelDimensions)
{
setPosition(pixelDimensions.x,pixelDimensions.y);
setSize(pixelDimensions.width,pixelDimensions.height);
}


to void Widget::setDimensions(const Rect& pixelDimensions)
{
setSize(pixelDimensions.width,pixelDimensions.height);
setPosition(pixelDimensions.x,pixelDimensions.y);
}


it fixes the problem. The reason why is because the scrollpane might be extended initially with the setPosition() call, which is using the default value of mSize, which may be larger than the actual size set by the user. Since scrollpanes are never shrunk, the scrollbars remain, even if the final widget layout doesn't have anything outside the widget.

kungfoomasta

13-03-2008 16:50:39

Good find, that makes sense.

OT: I've been slowing thinking about redoing the rendering portion of QuickGUI. I've been looking at RBGUI as a reference, and I must say their process for rendering widgets is really good.