Question

If I have elements inside my gridLayout, can I get the reference to that object, if yes, which function do I need to use? Is it good idea to perform some actions on the objects inside gridLayout? Or there is another better language idiom?

Was it helpful?

Solution

No you cannot get references to items from a layout. However, you can from the container that holds the button. A better solution might be to hold a reference to the button at a higher level of scope in order to be able to access it later.

OTHER TIPS

You can't get stuff out of a LayoutManager unless it specifically supports it, and GridLayout doesn't.

If you are putting Components into a Container then you probably have a reference to them anyway. Can't you pass this reference around?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top