Transfer labelinput to other window


i try to make a Pop-Up Window (DialogWindow) for my Application, where i add a Label, and i want to use the input from the Label in my Main Application.

So far i managed to get a DialogWindow opened, including a Label which i can edit. But i stuck in the process, that when i close the DialogWindow that it transfers my inputted label text to, lets say a String or other Label in my MainWindow.

I thought of do it with the labelTextChanged function, but i think i cant access the Main Window from the DialogWindow, cause its a child, if i understood right.

Any Ideas?


You can use LabelListener.
And then you will be able to catch label changes in your mainEditor.

Oh, i hoped that it works like that. But what function or code do i need to catch a labelchange from another file/window?

I know, i can add listener and then it calls the function for example “labelTextChanged” in the same cpp file.

But how can i get the Change in another CPP file?

How about like this?

In your mainEditor

in your childWindow
void addListener(LabelListener* listener)

Then catching label changes in your mainEditor.

1 Like


looked at your code and it gave me an idea. I now think i found a solution, but kind other way.

I launch my DialogWindow with that piece of Code, triggered through an TextButton:

void MainContentComponent::buttonClicked (Button *buttonClicked)
    DialogWindow::LaunchOptions launchOptions;
    launchOptions.dialogTitle = "TEST";
    launchOptions.content.setOwned(tempComp = new dialogComponent);

In my MainContentComponent-Class i have the

dialogComponent *tempComp;

under Private section.

That was all the magic.

Hope that solution is solid and i didnt overlooked some failures which could reveal later.
If you see, pls tell me.
Thanks for your answer, it helped me alot!