Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • 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: 2703
10
  • 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.
 
I do some of my very best work in water. Like this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!