Created
March 25, 2014 13:37
-
-
Save julsam/9761931 to your computer and use it in GitHub Desktop.
Test Slider for haxeui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<vbox width="100%" height="100%" style="spacing:2;"> | |
<tabview width="100%" height="100%" id="documenttabs"> | |
<hbox> | |
<grid columns="8"> | |
<text text="Min" /> | |
<hslider id="min" min="-200" max="200" pos="-200" width="150"/> | |
<text text="Pos: " /> | |
<text id="minLabelPos" text="" /> | |
<text text="Min: " /> | |
<text id="minLabelMin" text="" /> | |
<text text="Max: " /> | |
<text id="minLabelMax" text="" /> | |
<text text="Max" /> | |
<hslider id="max" min="-200" max="200" pos="200" width="150"/> | |
<text text="Pos: " /> | |
<text id="maxLabelPos" text="" /> | |
<text text="Min: " /> | |
<text id="maxLabelMin" text="" /> | |
<text text="Max: " /> | |
<text id="maxLabelMax" text="" /> | |
<text text="Pos" /> | |
<hslider id="pos" min="-200" max="200" pos="0" width="150"/> | |
<text text="Pos: " /> | |
<text id="posLabelPos" text="" /> | |
<text text="Min: " /> | |
<text id="posLabelMin" text="" /> | |
<text text="Max: " /> | |
<text id="posLabelMax" text="" /> | |
</grid> | |
<spacer width="20" /> | |
<hprogress id="theScroll" /> | |
<hslider id="theSlider" /> | |
<vprogress id="theVScroll" /> | |
<vslider id="theVSlider" /> | |
</hbox> | |
</tabview> | |
</vbox> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package haxe.ui.toolkit; | |
import haxe.ui.toolkit.core.XMLController; | |
@:build(haxe.ui.toolkit.core.Macros.buildController("assets/testProgressSlider.xml")) | |
class TestSlider extends XMLController { | |
public function new() { | |
function updateMin() { | |
theScroll.min = min.pos; | |
theSlider.min = min.pos; | |
theVScroll.min = min.pos; | |
theVSlider.min = min.pos; | |
minLabelPos.text = Std.string(min.pos); | |
minLabelMin.text = Std.string(min.min); | |
minLabelMax.text = Std.string(min.max); | |
} | |
function updateMax() { | |
theScroll.max = max.pos; | |
theSlider.max = max.pos; | |
theVScroll.max = max.pos; | |
theVSlider.max = max.pos; | |
maxLabelPos.text = Std.string(max.pos); | |
maxLabelMin.text = Std.string(max.min); | |
maxLabelMax.text = Std.string(max.max); | |
} | |
function updatePos() { | |
theScroll.pos = pos.pos; | |
theSlider.pos = pos.pos; | |
theVScroll.pos = pos.pos; | |
theVSlider.pos = pos.pos; | |
posLabelPos.text = Std.string(pos.pos); | |
posLabelMin.text = Std.string(pos.min); | |
posLabelMax.text = Std.string(pos.max); | |
} | |
// update all of them on start | |
updateMin(); | |
updateMax(); | |
updatePos(); | |
min.onChange = function(e) { | |
updateMin(); | |
}; | |
max.onChange = function(e) { | |
updateMax(); | |
}; | |
pos.onChange = function(e) { | |
updatePos(); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment