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

    clever-oil-61353

    05/23/2020, 9:35 PM
    since property group is the container for the properties
  • c

    clever-oil-61353

    05/23/2020, 9:35 PM
    wonderful
  • m

    most-caravan-45834

    05/23/2020, 9:35 PM
    Copy code
    haxe
    package editor;
    
    import haxe.ui.macros.ComponentMacros;
    import haxe.ui.containers.VBox;
    import haxe.ui.containers.properties.Property;
    import haxe.ui.containers.properties.PropertyGrid;
    import haxe.ui.containers.dialogs.Dialog;
    import haxe.ui.containers.dialogs.Dialog.DialogEvent;
    
    class MapProperties extends Dialog
    {
        var uiRoot: VBox;
        var mapIdProperty: Property;
    
        public function new()
        {
            super();
    
            uiRoot = ComponentMacros.buildComponent("assets/editor/xml/map_properties.xml");
    
            mapIdProperty = uiRoot.findComponent("map_id", Property, true);
            
            title = "Map Properties";
            buttons = DialogButton.CANCEL | DialogButton.APPLY;
    
            onDialogClosed = onClose;
    
            addComponent(uiRoot);
        }
    
        function onClose(e: DialogEvent)
        {
            trace(mapIdProperty);
    
            trace(mapIdProperty.value);
        }
    }
  • m

    most-caravan-45834

    05/23/2020, 9:36 PM
    But I still don't know exactly what this line does:
    Copy code
    haxe
    @:build(haxe.ui.macros.ComponentMacros.build("assets/editor/xml/map_properties.xml"))
  • c

    clever-oil-61353

    05/23/2020, 9:38 PM
    that line, simplest way i know.... prebuilds and prepares the data needed for what may be asked of it from within that class or page it is within. It ties the data to that class it is called with. I believe thats how that works.
  • m

    most-caravan-45834

    05/23/2020, 9:38 PM
    But ultimately it should add itself to Dialog hierarchy as a child right?
  • m

    most-caravan-45834

    05/23/2020, 9:39 PM
    Assuming that, I also assumed searching for something on Dialog recursively would also work, but aparently it doesn't
  • c

    clever-oil-61353

    05/23/2020, 9:40 PM
    in the way you use the buildcomponent, it ties it to the uiRoot
  • c

    clever-oil-61353

    05/23/2020, 9:40 PM
    in your code
  • c

    clever-oil-61353

    05/23/2020, 9:41 PM
    in your case, VBox is the Warden.... you want answers for anything held within, you ask the Warden..... its his block to control.
  • m

    most-caravan-45834

    05/23/2020, 9:42 PM
    This is clear. But when I use
    Copy code
    haxe
    @:build(haxe.ui.macros.ComponentMacros.build("assets/editor/xml/map_properties.xml"))
    How can I find components contained in map_properties.xml afterwards?
  • c

    clever-oil-61353

    05/23/2020, 9:44 PM
    in stead of buildComponent, just use the findComponent. i believe it is.
  • c

    clever-oil-61353

    05/23/2020, 9:45 PM
    there shouldnt be a need to build again afterwords, all the data will be availabe to what ever needs it then so long as that class or module is called within other classes or modules so to speak. Then being able to share the info.
  • m

    most-caravan-45834

    05/23/2020, 9:45 PM
    that's what I did before, got null
  • c

    clever-oil-61353

    05/23/2020, 9:46 PM
    I may not understand that part perfectly, but.... its how im understanding it. ahhhhhh..... i think i see now....
  • c

    clever-oil-61353

    05/23/2020, 9:47 PM
    mapIdProperty = findComponent("map_id", Property, true);
  • c

    clever-oil-61353

    05/23/2020, 9:47 PM
    lass MapProperties extends Dialog { var uiRoot: VBox; var mapIdProperty: Property; public function new() { super(); uiRoot = ComponentMacros.buildComponent("assets/editor/xml/map_properties.xml"); mapIdProperty = uiRoot.findComponent("map_id", Property, true);
  • c

    clever-oil-61353

    05/23/2020, 9:47 PM
    give me just a sec.... to type this....
  • c

    clever-oil-61353

    05/23/2020, 9:48 PM
    var mapIdProperty = MapProperties;
  • c

    clever-oil-61353

    05/23/2020, 9:49 PM
    after that...... then, mapIdProperty = uiRoot.findComponent("map_id", Property, true);
  • c

    clever-oil-61353

    05/23/2020, 9:49 PM
    if using the @build.........
  • c

    clever-oil-61353

    05/23/2020, 9:50 PM
    that, i believe should do the trick
  • c

    clever-oil-61353

    05/23/2020, 9:50 PM
    or something real close.....
  • b

    bright-gpu-74537

    05/23/2020, 9:51 PM
    ill look at this tomorrow, but the first example:
  • b

    bright-gpu-74537

    05/23/2020, 9:52 PM
    Copy code
    haxe
    package editor;
    
    import haxe.ui.containers.properties.Property;
    import haxe.ui.containers.properties.PropertyGrid;
    import haxe.ui.containers.dialogs.Dialog;
    import haxe.ui.containers.dialogs.Dialog.DialogEvent;
    
    @:build(haxe.ui.macros.ComponentMacros.build("assets/editor/xml/map_properties.xml"))
    class MapProperties extends Dialog
    {
        var mapIdProperty: Property;
    
        public function new()
        {
            super();
    
            title = "Map Properties";
            buttons = DialogButton.CANCEL | DialogButton.APPLY;
    
            onDialogClosed = onClose;
        }
    
        function onClose(e: DialogEvent)
        {
            mapIdProperty = findComponent("map_id", Property, true);
    
            trace(mapIdProperty);
    
            trace(mapIdProperty.value);
        }
    }
  • b

    bright-gpu-74537

    05/23/2020, 9:52 PM
    makes complete sense and is exactly how i would have done it
  • b

    bright-gpu-74537

    05/23/2020, 9:52 PM
    so if the two traces are returning null, something is off
  • c

    clever-oil-61353

    05/23/2020, 9:53 PM
    wonderif mapIdProperty: PropertyGrid; would have done it in that
  • b

    bright-gpu-74537

    05/23/2020, 9:55 PM
    i dont see anything wrong with the original example (but i havent run it), if it doesnt work, it should (though i cant think of reason why it wouldnt work)... @User - can you zip the project? (im not going to look at it now though, but will do tomorrow)
  • c

    clever-oil-61353

    05/23/2020, 9:57 PM
    true.... it should have worked.
1...227228229...1687Latest