This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Parent class event listener  RSS feed

 
Thomas Moul
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a main gui that calls out a form for the user to fill out as a child class. I want the parent class(main gui) to know when the user clicks a button, so I was wondering if it's possible to create an event listener connected to the button from the parent class. I made the button public and could create the action event listener for the button in the parent class, but it still wouldn't recognize the button being clicked. Any help would be great, thanks.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your idea seems to work okay in the code below. You could also leave the listener in the same class as the component that it's registered on and have it call a method in the parent class to handle the notification of event occurrence.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!