2009-02-19

Combo box vs Button

I don't know exactly why, but I almost never use combo boxes/drop-down liste etc.

If we have an order with an order status, where order status can be cancelled, pending, approved and shipped.

I often see screens like this:

comboboxvsbutton1

The screen makes sense for most developers because that is how the data i structured in the database, usually with an Order and OrderStatus table.
In code this is mapped to an Order class and an OrderStatus enum, where the Order class has a Status property with the type of OrderStatus.

So its easy with data binding to make every property a field in the screen, and most data binding will happily make enum properties to combo boxes.

What does the user want to do

So how can we express the order status without a combo box?

Actually the question is not hard to answer, just try to understand what the user really wants.
”A user wants to be able to change the order from a status, to any status that is valid.”

In the above case, most likely not every order status is valid from all other order statuses. So its ok to go from Pending to Approved, but not from Shipped to Pending.

So the key is, to only show valid changes in order status, and to make the user able to trigger these changes.

A solution could look like this screen:

comboboxvsbutton2 

Conclusion

While simple data binding is easy to do in most platforms, it might not be the best solution – from a users perspective.