ScrollBar
#
Examples#
Basicimport { Window, ScrollBar } from 'ave-ui';
export function main(window: Window) { const scrollBar = new ScrollBar(window); scrollBar.SetMinimum(0).SetMaximum(100).SetValue(50).SetShrink(false); scrollBar.OnScrolling((sender: ScrollBar) => { console.log(sender.GetValue()); });
const container = getControlDemoContainer(window, 2, 120, 16); container.ControlAdd(scrollBar).SetGrid(1, 1, 2, 1); window.SetContent(container);}
In this example, we demonstrate the basic usage of scroll bar.
Drag it and get the current positon:
Log in console:
504949484847...363635353434
In the above example, we set shrink
to false
, which gives us a fixed size scroll bar. To be dynamically sized, set it to true
:
#
APIexport interface IScrollBar extends IControl { SetMinimum(min: number): ScrollBar; GetMinimum(): number;
SetMaximum(max: number): ScrollBar; GetMaximum(): number;
SetValue(value: number): ScrollBar; GetValue(): number;
SetShrink(shrink: boolean): ScrollBar; GetShrink(): boolean;
OnScrolling(callback: (sender: ScrollBar) => void): ScrollBar;}