bright-gpu-74537
03/06/2022, 9:18 PMbest-agent-85158
03/06/2022, 9:18 PMbright-gpu-74537
03/06/2022, 9:18 PMbest-agent-85158
03/06/2022, 9:18 PMbest-agent-85158
03/06/2022, 9:20 PMO in a row:
OOOOOOOOOOOOOOOO
set width to 81 since the letter O is 40 * 40 and enable wordWrap:
OO
OO
OO
OO
OO
OO
OO
OObest-agent-85158
03/06/2022, 9:20 PMbest-agent-85158
03/06/2022, 9:20 PMgetCharBoundariesbright-gpu-74537
03/06/2022, 9:21 PMbest-agent-85158
03/06/2022, 9:24 PMhaxe
var tf = new TextField();
var icon = new Button();
tf.text = "OOOOOOOOOOOOOOOO";
tf.width = 81;
tf.wordWrap = true;
tf.multiline = true;
addChild(tf);
for (i in 0...tf.text.length) {
var rect = tf.getCharBoundaries(i);
rect.x += tf.x;
rect.y += tf.y
icon.x = rect.x;
icon.y = rect.y;
}best-agent-85158
03/06/2022, 9:24 PMOO
OO
OO
OO
OO
OO
OO
OObest-agent-85158
03/06/2022, 9:24 PMO a button will be placedbright-gpu-74537
03/06/2022, 9:25 PMbest-agent-85158
03/06/2022, 9:25 PMbright-gpu-74537
03/06/2022, 9:25 PMbest-agent-85158
03/06/2022, 9:26 PMbest-agent-85158
03/06/2022, 9:26 PMy value higherbright-gpu-74537
03/06/2022, 9:26 PMbest-agent-85158
03/06/2022, 9:27 PMbest-agent-85158
03/06/2022, 9:30 PMspacing: -1 does itbest-agent-85158
03/06/2022, 9:31 PMxml
<vbox style="padding: 5px;">
<vbox style="spacing: -1">
<button-bar selectedIndex="0">
<button text="Button A1" />
<button text="Button A2" />
<button text="Button A3" />
</button-bar>
<button-bar selectedIndex="1">
<button text="Button B1" />
<button text="Button B2" />
<button text="Button B3" />
</button-bar>
<button-bar selectedIndex="2">
<button text="Button C1" />
<button text="Button C2" />
<button text="Button C3" />
</button-bar>
</vbox>
</vbox>bright-gpu-74537
03/06/2022, 9:31 PMbest-agent-85158
03/06/2022, 9:31 PMbright-gpu-74537
03/06/2022, 9:38 PMbright-gpu-74537
03/06/2022, 9:39 PMbright-gpu-74537
03/06/2022, 9:39 PMbright-gpu-74537
03/06/2022, 9:41 PMxml
<vbox style="padding: 5px;">
<style>
.toolbutton {
border: none;
background-color: $normal-background-color-end;
border-radius: 0;
padding: 5px 5px;
}
.toolbutton:down {
background-color: $accent-color;
}
</style>
<grid columns="2" style="border: 1px solid $normal-border-color;spacing:0;padding:1px;">
<button id="button1" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button2" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button3" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button4" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button5" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button6" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button7" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button8" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button9" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
<button id="button10" icon="haxeui-core/styles/default/haxeui_tiny.png" toggle="true" styleName="toolbutton" />
</grid>
</vbox>bright-gpu-74537
03/06/2022, 9:41 PMhaxe
@:build(haxe.ui.ComponentBuilder.build("assets/main-view.xml"))
class MainView extends VBox {
private var _currentButton:Button = null;
public function new() {
super();
}
@:bind(button1, MouseEvent.CLICK)
@:bind(button2, MouseEvent.CLICK)
@:bind(button3, MouseEvent.CLICK)
@:bind(button4, MouseEvent.CLICK)
@:bind(button5, MouseEvent.CLICK)
@:bind(button6, MouseEvent.CLICK)
@:bind(button7, MouseEvent.CLICK)
@:bind(button8, MouseEvent.CLICK)
@:bind(button9, MouseEvent.CLICK)
@:bind(button10, MouseEvent.CLICK)
private function onToolChange(e:MouseEvent) {
if (_currentButton != null) {
_currentButton.selected = false;
}
_currentButton = cast e.target;
_currentButton.selected = true;
}
}bright-gpu-74537
03/06/2022, 9:41 PMbest-agent-85158
03/07/2022, 6:27 AMbest-agent-85158
03/07/2022, 7:53 AM