Viewport bug in tip


#1

The Viewport Scrollbar behaviour is not correct in the tip from 4th Jan 2013.
Check the Juce Demo - Treeview Demo:
If the subtrees are opened, the Viewport adds a horizontal Scrollbar although no Scrollbar or a vertical Scrollbar would be correct.

I also encountered Problems with the TextEditor Scrollbars:
If the TextEditor is set to multiline and wordwrap=true, sometimes at the end of a line a horizontal Scrollbar is added automatically and the correct vertical Scrollbar disappears.When you type the next character the horizontal Scrollbar disappears, the vertical Scrollbar appears again and the word is moved to the next line.
See the image:
[attachment=0]texteditor_scrollbar.jpg[/attachment]


#2

No… In the demo, one of the items is 800 pixels wide, so the scrollbar is correct. Try making the window wider and it should be clear what’s going on.

I don’t have time to sit randomly playing with editor and font sizes to try to reproduce this, but if you can give me some code that always shows the problem, then I’ll take a look.


#3

Sorry, you’re right. My fault.

I’ll try to create a simple example that makes it easy to reproduce the problem.
I’ll post the code when I’m ready.


#4

Here’s a simple code snippet to reproduce the problem.
Add this code to the Juce Demo in the file “WidgetsDemo.cpp” (line 594):

[code]//==============================================================================
static Component* createMiscPage()
{
DemoPageComp* page = new DemoPageComp();

//Edit start------------------------------
Font f("Arial", 12.0f, Font::plain);
TextEditor* textEditorProblem = new TextEditor();
textEditorProblem->setFont(f);
textEditorProblem->setMultiLine (true);
textEditorProblem->setReturnKeyStartsNewLine (false);
textEditorProblem->setPopupMenuEnabled (false);
textEditorProblem->setScrollBarThickness(8);
textEditorProblem->setCaretVisible(true);
textEditorProblem->setIndents(3, 2);
textEditorProblem->setBorder(BorderSize<int>(1));
page->addAndMakeVisible (textEditorProblem);
textEditorProblem->setBounds (10, 400, 321, 45);
textEditorProblem->setText("gfdjhgdfjdj fdh dfh dfh fdh  dfhh fdh dfhfdh d fh  fdhh fdh fhfh fhfhf f");
//Edit end--------------------------------[/code]

When you open the Demo and go to the Widgets Demo -> misc widgets tab, then you’ll see that the newly added Texteditor shows a horizontal scrollbar. When you type some characters it disappears. Depending on what you type, it may or may not appear on the next lines.
The expected behaviour for a multiline Texteditor would be to always do a line break instead of sometimes adding a horizontal scrollbar. Or did I get that wrong?


#5

Thanks, it was just out by a pixel - I’ve checked in a fix now.


#6

Wow, that was quick.
Thanks.