best-agent-85158
05/30/2022, 7:24 PMbest-agent-85158
05/30/2022, 7:24 PMmagnificent-crayon-8615
05/30/2022, 9:04 PM.rotation, because components are openfl DisplayObjects, but this will make the UI, framework dependent (there's probably the same in the others frameworks/backends, but I don't know exactly what they are...)best-agent-85158
05/30/2022, 9:06 PMmagnificent-crayon-8615
05/30/2022, 9:17 PMmagnificent-crayon-8615
05/30/2022, 9:19 PMmagnificent-crayon-8615
05/30/2022, 9:21 PMmost-caravan-45834
05/31/2022, 1:33 AMbest-agent-85158
05/31/2022, 6:01 AMbest-agent-85158
05/31/2022, 6:01 AMmagnificent-crayon-8615
05/31/2022, 9:22 AMmagnificent-crayon-8615
05/31/2022, 9:46 AMbest-agent-85158
05/31/2022, 10:01 AMloud-salesclerk-7438
05/31/2022, 10:14 AMmagnificent-crayon-8615
05/31/2022, 10:42 AM.customStyle or .styleString or even use some already added class css names with .styleNames.addClass or .addClasses - see two messages below about class names) to a component (there's more ways, but I don't use code for styling, sorry). But you could do, probably, even better, and use a global.css file (or other name for that matter), and then reference it in the module.xml like this:
xml
<themes>
<global>
<style resource="path-to-file/global.css" />
</global>
</themes>
and the css that you put in there will be globally applied, and if you put some new class names in there, then you can apply those with .styleNames in the component itself
(note take this with a grain of salt, because I didn't try any of this myself, I use XML and CSS files almost everywhere 😁 )magnificent-crayon-8615
05/31/2022, 10:51 AMmagnificent-crayon-8615
05/31/2022, 12:28 PM.addClass, .swapClass and .removeClass (add `es`in the end for more than one at once) respectably. Sorry, for the confusion, but I don't usually use styling by code 😅best-agent-85158
05/31/2022, 2:45 PMbest-agent-85158
05/31/2022, 2:45 PMmagnificent-crayon-8615
05/31/2022, 5:01 PMmain-view.xml in a fresh project (in assets folder or somewhere else), and create a Mainview.hx to create a custom component just to bare all the UI for the app, like this:
haxe
package ;
import haxe.ui.containers.VBox;
@:build(haxe.ui.ComponentBuilder.build("assets/main-view.xml"))
class MainView extends VBox {
public function new() {
super();
}
}
in the Main.hx do:
haxe
package ;
import haxe.ui.HaxeUIApp;
class Main {
public static function main() {
var app = new HaxeUIApp();
var mainview = new MainView();
app.ready(function() {
app.addComponent(mainview);
app.start();
});
}
}magnificent-crayon-8615
05/31/2022, 5:01 PMxml
<vbox style="padding: 5px;">
<style>
/* thumb portion */
.classic-scrolls .thumb {
background-color: red;
}
/* both up/down arrow buttons */
.classic-scrolls .deinc,
.classic-scrolls .inc {
background-color: green;
}
</style>
<scroll id="testscroll" direction="vertical" pos="100" pageSize="50" styleName="classic-scrolls"/>
</vbox>
And now you can access the slider component inside the Mainview.hx using this.testscroll.pos = 50; (you can use intellisense for all, including the name of the scroll) and in Main.hx you can access the scroll by using mainview.testscroll.width = 200;, also with intellisense.
And you can arrange your UI from a "million" different way, like creating a class for left sidebar, other to the right sidebar, other to the menu and add those to the Mainview.hx and have intellisense everywhere and still enjoy a clean short code, with the UI separated in xml files styled with css, also in files, and any change or whatever is simply go to the xml/css change the properties and see the magic happen, no need to code endless .width, etc lines, just do the logic with them, nice and neat, but that's my opinion (don't requires "follow by the book" 😅 )magnificent-crayon-8615
05/31/2022, 5:02 PMbest-agent-85158
05/31/2022, 5:07 PMbest-agent-85158
05/31/2022, 5:07 PMbest-agent-85158
05/31/2022, 5:07 PMmagnificent-crayon-8615
05/31/2022, 5:11 PMmagnificent-crayon-8615
05/31/2022, 5:12 PMmagnificent-crayon-8615
05/31/2022, 5:12 PMmagnificent-crayon-8615
05/31/2022, 5:14 PMmodule.xml and easily add them in any xml you wantmagnificent-crayon-8615
05/31/2022, 5:16 PM