Is it possible to target a frame component?

Is it possible to “findComponent” a frame ?
I tried but it looks like it just ignore the id and returns null

this.frame = this.widget.findComponent('frame123', null, true);

<frame id="frame123" text="test">
</frame>

What I need to do is to change frame text

ty

.widget is the hxWidgets component (not the haxeui component) it is essentially a haxe wrapper around a wxWidget component. In general you should never need to access it (though if you want to access the raw hxWidgets api, its there for that). So, findComponent is a haxeui api function, so .widget doesnt that that.

You should just be able to do something like this.frame = this.findComponent(...)

If thats not what you mean, going to need more code as ive misunderstood something :slight_smile:

Cheers,
Ian

I’m sorry, my fault :slight_smile:

this.widget and this.frame are in fact properties of my class
this.widget = ComponentMacros.buildComponent('xmlfile.xml');

findComponent works correctly with all the other components, except frame
EDIT: in fact I didn’t try vbox or containers

Hmm, thats strange, there nothing special about the frame, can you paste in the full xml and the full .hx so i know were looking at the same thing… looks like a bug though… no idea what it could be though… frame is a pretty simple / basic component

This is simplified as much as possible :smiley:

The code

class Main {
public static function main() {
    var app = new HaxeUIApp();
    app.ready(function() {

        var test:Component = ComponentMacros.buildComponent("assets/views/test.xml");
        var frame = test.findComponent('frame123');
        trace(frame);

        app.start();
    });
}

}

the xml

<frame id="frame123" text="test">
</frame>

ok, so in that example, test is frame (ie, the root node / component). Are you saying though if you wrap the frame in a vbox:

<vbox>
    <frame id="frame123" text="test">
    </frame>
</vbox>

then your original code doesnt work?

Yep, it works inside a vbox, but I didn’t try it before

So Frame can’t be the root ? I mean I’m ok with that, it’s just to know :slight_smile:

No, frame can be the root, its just that you are trying to find a component called “frame123” from “frame123”, ie:

var frame:Frame = ComponentMacros.buildComponent("assets/views/test.xml"); // <--- "frame" is the root component, which _is_ frame123 in this case
frame.text = "New Text";

rather than:

var frame:Frame = ComponentMacros.buildComponent("assets/views/test.xml");
frame.findComponent("frame123", Frame).text = "New Text"; // <--- here you are trying to find a child called "frame123" when the parent already is the "frame123"

That make sense?

1 Like

Oh, I see

For some unknown reason :slight_smile: I supposed that buildComponent would return a sort of “wrapper”

1 Like

Nope, it returns the actual component instance