Help about how to use global values


#1

Hello everyone

I create a TextEditor on the main component window, and I use DialogWindow::showModalDialog to create a child dialog,

I want to ask when the child ModalDialog window is open, in the child ModalDialog component window class, how can I access or use the TextEditor pointer which is in the parent component window class to set some text in the main TextEditor?

I try to put the TextEditor pointer outside the main component class as the global values, but I can not access the pointer in the child ModalDialog component window class, when linking, it outputs the linking-error infomation.

Can anyone told me how to solve this problem?


#2

The best way to do it would be that when you create your modal dialog, give it a pointer to the text editor (and anything else) that it needs. Global variables generally mean you’ve designed something a bit sloppily (though they do have their uses)


#3

Thanks

I will try to pass the pointer as the argument.