How to change the argument `scroll` for Window class?

Hello,

Window.new makes a window with the scroll argument set to false by default.
Is it possible to change this argument to true for an existing window?

best,

The scroll parameter is just a shortcut for creating an entirely different kind of Window: supercollider/SCClassLibrary/Common/GUI/Base/QWindow.sc at develop · supercollider/supercollider · GitHub

The way this is done is kind of a hot mess, I think it was only added for backwards compatibility. If you want to make scrollable views, I would suggest just using ScrollView inside a normal window.

(
Window(resizable:false, bounds:200@200).layout_(StackLayout(
    ScrollView().canvas_(
        TextView()
            .fixedHeight_(600)
            .string_("hello")
    )
)).front;
)
1 Like

Thank you for your reply!

Um… The code below

(
var window = Window();
window.view.hasHorizontalScroller_(false).background_(Color.grey(0.9));
)

returns the following error:

ERROR: Message ‘hasHorizontalScroller_’ not understood.

I applied your code to the code above, but the same error occurs:

(
var window = Window();
window.layout_(StackLayout(ScrollView()));// <- adopted from your template code
window.view.hasHorizontalScroller_(false).background_(Color.grey(0.9));
)

Is there a way to do this?
I seem to need to convert the a TopView of a window to an a TopScrollView of the same window.

hasHorizontalScroller_ is a property of ScrollView, you’ll have to set it on that.

(
Window(resizable:false, bounds:200@200).layout_(StackLayout(
    scrollView = ScrollView()
        .hasHorizontalScroller_(false)
        .canvas_(
            TextView()
                .fixedHeight_(600)
                .string_("hello")
        )
)).front;
)
1 Like