• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doClick is Bad ?

 
Jason Wylde
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I currently have some code in my save button's listener but I have now written logic to check if there are unsaved changes. My question is would it be considered bad coding to simply call the save's doClick function or should I put the code from the save button in it's own function and then call that function from the save button and from the closing of the window ?


Thanks In Advance
 
Rob Camick
Ranch Hand
Posts: 2616
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My suggestion (which is more or less your second approach) can be found in the Closing An Application entry. Basically you create a Save Action that is invoked by a CloseListener. So your Save button would simply use the ExitAction provided in the blog to close the window.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic