I have run into a problem when trying to set a custom style to HScrollBar and VScrollbar. Doing this in my my theme according to documentation:
styleProvider.setStyleFunction(HScrollBar, null, setHScrollBarStyles);
styleProvider.setStyleFunction(VScrollBar, null, setVScrollBarStyles);
private function setHScrollBarStyles(scrollBar:HScrollBar):Void {
trace("set hscroll style");
var trackSkin = new RectangleSkin();
trackSkin.fill = SolidColor(0x000000,0);
//trackSkin.width = 120.0;
trackSkin.height = 20.0;
//trackSkin.alpha = 0.0;
scrollBar.trackSkin = trackSkin;
}
private function setVScrollBarStyles(scrollBar:VScrollBar):Void {
trace("set vscroll style");
var trackSkin = new RectangleSkin();
trackSkin.fill = SolidColor(0x000000,0);
trackSkin.width = 20.0;
//trackSkin.alpha = 0.0;
scrollBar.trackSkin = trackSkin;
}
When setting null for the variant and running openfl test neko or cpp the app crashes and I get this:
Called from feathers/controls/HScrollBar.hx line 85
Called from feathers/controls/supportClasses/BaseScrollBar.hx line 577
Called from feathers/core/ValidatingSprite.hx line 259
Called from a C function
Called from feathers/core/FeathersControl.hx line 704
Called from feathers/controls/supportClasses/BaseScrollContainer.hx line 1220
Called from feathers/controls/supportClasses/BaseScrollContainer.hx line 1075
Called from a C function
Called from feathers/controls/ScrollContainer.hx line 436
Called from a C function
Called from feathers/controls/Panel.hx line 162
Called from feathers/core/ValidatingSprite.hx line 259
Called from a C function
Called from feathers/core/FeathersControl.hx line 704
Called from a C function
Called from feathers/controls/ScrollContainer.hx line 414
Called from feathers/layout/AnchorLayout.hx line 76
Called from feathers/controls/LayoutGroup.hx line 687
Called from feathers/controls/LayoutGroup.hx line 459
Called from feathers/core/ValidatingSprite.hx line 259
Called from a C function
Called from feathers/core/FeathersControl.hx line 704
Called from a C function
Called from feathers/controls/LayoutGroup.hx line 431
Called from feathers/controls/LayoutGroup.hx line 707
Called from feathers/controls/LayoutGroup.hx line 461
Called from a C function
Called from feathers/controls/Application.hx line 139
Called from feathers/core/ValidatingSprite.hx line 259
Called from a C function
Called from feathers/core/FeathersControl.hx line 704
Called from a C function
Called from feathers/controls/LayoutGroup.hx line 431
Called from feathers/core/ValidationQueue.hx line 156
Called from feathers/core/ValidationQueue.hx line 162
Called from openfl/events/EventDispatcher.hx line 402
Called from a C function
Called from openfl/display/DisplayObject.hx line 1399
Called from openfl/display/Stage.hx line 1159
Invalid field access : restore
Called from ? line 1
Called from ApplicationMain.hx line 25
Called from ApplicationMain.hx line 130
Called from lime/app/Application.hx line 150
Called from lime/internal/backend/native/NativeApplication.hx line 146
Called from a C function
Called from lime/internal/backend/native/NativeApplication.hx line 370
Called from lime/_internal/macros/EventMacro.hx line 91
Called from openfl/display/Stage.hx line 1971
Called from openfl/display/Stage.hx line 1163
Called from openfl/display/Stage.hx line 1423
Called from openfl/display/Stage.hx line 1159
Called from openfl/display/DisplayObject.hx line 1399
Called from a C function
Called from openfl/events/EventDispatcher.hx line 402
Called from feathers/core/ValidationQueue.hx line 162
Called from feathers/core/ValidationQueue.hx line 156
Called from feathers/controls/LayoutGroup.hx line 431
Called from a C function
Called from feathers/core/FeathersControl.hx line 704
Called from a C function
Called from feathers/core/ValidatingSprite.hx line 259
Called from feathers/controls/Application.hx line 139
Called from a C function
Called from feathers/controls/LayoutGroup.hx line 461
Called from feathers/controls/LayoutGroup.hx line 707
Called from feathers/controls/LayoutGroup.hx line 431
Called from a C function
Called from feathers/core/FeathersControl.hx line 704
Called from a C function
Called from feathers/core/ValidatingSprite.hx line 259
Called from feathers/controls/LayoutGroup.hx line 459
Called from feathers/controls/LayoutGroup.hx line 687
Called from feathers/layout/AnchorLayout.hx line 76
Called from feathers/controls/ScrollContainer.hx line 414
Called from a C function
Called from feathers/core/FeathersControl.hx line 704
Called from a C function
Called from feathers/core/ValidatingSprite.hx line 259
Called from feathers/controls/Panel.hx line 162
Called from a C function
Called from feathers/controls/ScrollContainer.hx line 436
Called from a C function
Called from feathers/controls/supportClasses/BaseScrollContainer.hx line 1075
Called from feathers/controls/supportClasses/BaseScrollContainer.hx line 1220
Called from feathers/core/FeathersControl.hx line 704
Called from a C function
Called from feathers/core/ValidatingSprite.hx line 259
Called from feathers/controls/supportClasses/BaseScrollBar.hx line 577
Called from feathers/controls/HScrollBar.hx line 85
Uncaught exception - Invalid field access : restore
If I don't set null and simply do "" it runs but the style is not applied.
Is there a workaround to this? I am trying to style the ScrollContainer