سؤال

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?

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top