I was asked by a client to create a tool that would let a user add/modify/delete/read content from a database. The content can be read from TextBoxes.
My question is, what is the best way to manage GUI locks/unlocks for the different states of the program. IE: If I’m in a “insert” mode, some GUI elements should be enabled, and some not. If I’m in the “read-only” mode, a bunch of them should be disabled… etc.
Right now I’ve created some methods in my GUI Class, that should manage this. However, the states should be managed in similar ways I guess…
The program is currently developed in Java, but I’ve had this problem in .Net before.
Edit: As I can see, some people think this question is too general. I’m looking for patterns, techniques, etc…
Your question is too broad.
There are many different approaches to maintain the visibility and enabled/disabled status of your controls in your GUI. As long as you are using .Net I would recommend looking at Commands in WPF: here you can bind the enabled property of your controls to
CanExecuteproperty of command and just maintain the availability of your commands — your controls will automatically reflect the changes.