TankOs/SFGUI — Issue #127: ScrolledWindow positioning(?)
Author: TankOs
Created: 2012-01-30 10:48:47+00:00
State: open
Labels: @@BUG, @Confirmed, Widgets

ScrolledWindow seems to do some weird positioning (maybe even Viewport-related).

Minimal example: (see screenshot below)

```cpp
#include
#include

int main() {
sf::RenderWindow render_window( sf::VideoMode( 800, 600 ), "Example" );

sfg::Box::Ptr lines_box = sfg::Box::Create( sfg::Box::VERTICAL, 5.f );

sfg::ScrolledWindow::Ptr scrolled = sfg::ScrolledWindow::Create();
scrolled->AddWithViewport( lines_box );

sfg::Window::Ptr window = sfg::Window::Create( sfg::Window::Toplevel );
window->SetTitle( L"Example" );
window->Add( scrolled );

lines_box->Pack( sfg::Label::Create( L"A line of text." ), false );
lines_box->Pack( sfg::Label::Create( L"Eeeeek." ), false );
lines_box->Pack( sfg::Label::Create( L"Foobar." ), false );
lines_box->Pack( sfg::Label::Create( L"Baz meow." ), false );

sfg::Desktop desktop( render_window );
desktop.Add( window );

window->SetAllocation( sf::FloatRect( 0, 0, 400, 400 ) );

sf::Event event;
sf::Clock clock;

while( render_window.IsOpen() ) {
while( render_window.PollEvent( event ) ) {
if( event.Type == sf::Event::Closed ) {
render_window.Close();
}
else {
desktop.HandleEvent( event );
}
}

desktop.Update( clock.GetElapsedTime().AsSeconds() );
clock.Restart();

render_window.Clear();
sfg::Renderer::Get().Display( render_window );
render_window.Display();

}
}
```

![screenshot](http://www.abload.de/img/sfgui_bugg9q61.png)