https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • e

    early-butcher-76809

    02/26/2023, 6:09 PM
    Ah, I gotta do the whole thing ! Makes sense
  • c

    cool-musician-79004

    02/26/2023, 6:09 PM
    Can the output of the playground be executed in a separate window? It doesn't work very nice embedded in mobile
  • b

    bright-gpu-74537

    02/26/2023, 6:10 PM
    fair point... you cant currently, but not a bad idea
  • c

    clever-yak-82528

    02/26/2023, 6:52 PM
    there is an annoying lack of good documentation for hxcpp
  • b

    bored-sandwich-20283

    02/26/2023, 7:12 PM
    i am trying to make a custom component for haxeUI-openfl that can show a openFL movieclip , i got a few ideas on what and how i want to use it but the first step is simply to get some openFL asset rendered. are there any resources explaining how to create custom components with custom render logic ?
  • b

    bored-sandwich-20283

    02/26/2023, 7:22 PM
    since it looks like the base class is a Sprite i guess i could just add openFL stuff with either graphics or addChild but it probably wont get any of the benefits and features that a properly implemented Component would, right ?
  • b

    bright-gpu-74537

    02/26/2023, 7:28 PM
    yeah, i was just building an example component:
  • b

    bright-gpu-74537

    02/26/2023, 7:32 PM
    Copy code
    haxe
    class CustomOpenFLComponent extends Box {
        private var _sprite:Sprite;
    
        public function new() {
            super();
            _sprite = new Sprite();
            _sprite.graphics.clear();
            _sprite.graphics.beginFill(0xff0000);
            _sprite.graphics.lineStyle(1, 0x00ff00);
            _sprite.graphics.drawRect(0, 0, 50, 50);
            _sprite.graphics.endFill();
            addChild(_sprite);
        }
    
        private override function validateComponentLayout():Bool {
            var b = super.validateComponentLayout();
            _sprite.width = this.width;
            _sprite.height = this.height;
            return b;
        }
    }
  • b

    bright-gpu-74537

    02/26/2023, 7:32 PM
    example usage:
  • b

    bright-gpu-74537

    02/26/2023, 7:32 PM
    Copy code
    xml
        <grid columns="3">
            <button text="Button" />
            <button text="Button" width="100%" />
            <button text="Button" />
    
            <button text="Button" height="100%" />
            <custom-openfl-component width="100" height="100" />
            <button text="Button" height="100%" />
    
            <button text="Button" />
            <button text="Button" width="100%" />
            <button text="Button" />
        </grid>
  • b

    bored-sandwich-20283

    02/26/2023, 7:33 PM
    cheers 😄
  • b

    bored-sandwich-20283

    02/26/2023, 7:35 PM
    i am trying to write some of my stuff as code and not as XML, but i am clearly missing something, if i set width my component disapear
    Copy code
    haxe
            var app = new HaxeUIApp();
            Toolkit.theme = "dark";
            app.ready(function() {
    
               var mainView =  new VBox();
                var menubar = new MenuBar();
    
                menubar.percentWidth = 100.0;
                var menuItem = new MenuItem();
    
                menubar.addComponent(menuItem);
                mainView.addComponent(menubar);
                app.addComponent(mainView);
          app.start();
            });
  • b

    bright-gpu-74537

    02/26/2023, 7:36 PM
    mainview also needs a width, either fixed or %
  • b

    bored-sandwich-20283

    02/26/2023, 7:36 PM
    is it 0-1 or 0-100 ?
  • b

    bored-sandwich-20283

    02/26/2023, 7:37 PM
    asking as the type is a f.loat
  • b

    bright-gpu-74537

    02/26/2023, 7:37 PM
    100% means "100% of parent", and the parent there is "autosized" which means "size of the children", which is 100% (loop, loop, loop)... so everything ends up as 0 in your case
  • b

    bright-gpu-74537

    02/26/2023, 7:37 PM
    0 -> 100
  • b

    bored-sandwich-20283

    02/26/2023, 7:43 PM
    so i tried the xml example you posted but i get :
    Warning : no class found for component: customopenflcomponent
    how do i tell haxeUI where the class is or what packages to look into ?
  • b

    bright-gpu-74537

    02/26/2023, 7:43 PM
    you need to register in a module.xml
  • b

    bright-gpu-74537

    02/26/2023, 7:43 PM
    (if you are using xml)
  • b

    bright-gpu-74537

    02/26/2023, 7:44 PM
    http://haxeui.org/api/guides/custom-components.html
  • b

    bright-gpu-74537

    02/26/2023, 7:44 PM
    ( http://haxeui.org/api/guides/modules.html also might shed some light)
  • b

    bored-sandwich-20283

    02/26/2023, 7:54 PM
    still strugling a bit. i have put my module.xml in the same folder as my main-view (/assets)
    Copy code
    xml
    <module id="my-stuff">
        <components>
            <component class="test.CustomOpenFLComponent" />
        </components>
    </module>
    and the component (CustomOpenFLComponent) in a package called test bit i still get no class found
  • b

    bright-gpu-74537

    02/26/2023, 7:56 PM
    module.xml needs to be on your class path to be discovered by haxeui... ... so like your "src" dir
  • b

    bored-sandwich-20283

    02/26/2023, 7:56 PM
    ah.. makes sense
  • b

    bright-gpu-74537

    02/26/2023, 7:59 PM
    btw, if you are using the component from code, you dont need to use a module.xml or anything, thats literally just for exposing to xml
  • b

    bored-sandwich-20283

    02/26/2023, 8:23 PM
    now i am looking into using widnows, but i cant see any class or package for
    haxe.ui.containers.windows.Window
    is it something custom ? https://www.haxeui.org/explorer/#containers/windows
  • b

    bright-gpu-74537

    02/26/2023, 8:24 PM
    what version of haxeui are you using?
  • b

    bored-sandwich-20283

    02/26/2023, 8:24 PM
    1.5
  • b

    bright-gpu-74537

    02/26/2023, 8:24 PM
    use git version... ... ... of everything... always 🙂
1...154215431544...1687Latest