Savas Aydin wrote:I want to implement a common configuration panel in my GUI like described in Andrew's book.
Savas Aydin wrote:I will disable action buttons if configuration is not valid. But I have a problem related to focus listener. Action buttons aren't enabled in some cases. For instance, in standalone mode, connect button is left disabled after user enters a valid database path from keyboard because focus lost event isn't thrown (user didn't clicked outside of database location text field). There is no problem when user clicks Browse button and selects file with file chooser. Do you think this is acceptable?
Savas Aydin wrote:Do you think this is acceptable?
Roel De Nijs wrote:When the user clicks the button, an error message is shown and the button is disabled.
Roel De Nijs wrote:I also have a common panel for the configuration settings, combined with disabling buttons using a FocusListener.
So I re-ran my application and I'm experiencing the same behavior: when user enters the path to the database file location manually the Connect button is not disabled. When the user clicks the button, an error message is shown and the button is disabled.
Sean Keane wrote:Why is an error message shown?
Savas Aydin wrote:1) After user enters an invalid file, the application shows a error dialog and disable connect button (I am assuming you don't enable it unless valid config entered).
2) User enters a valid database path using keyboard (without using file chooser)
3) I guess connect button will not be enabled unless user press TAB (or any action that will cause focus loss)
Sean Keane wrote:The end user has no idea why a certain component is disabled - they have to guess.
Sean Keane wrote:There is no benefit to disabling the connect button.
Sean Keane wrote:If you use Windows OS. Open up Notepad. Choose File->Open from the menu. Look at the Open button that is displayed on the File Chooser dialog - is the Open button disabled? Type in an invalid file name - is the Open button disabled?
Roel De Nijs wrote:And it's also mentioned in the user manual.
Sean Keane wrote:The only applications I have come across that change the state of buttons like this are applications aimed at technical users - which wouldn't be the target audience of this project. Eclipse for example disables the "Finish" button when you are creating a class. It only enables the button when a valid class name is entered.
Sean Keane wrote:You can simply validate the file when you user clicks on the button