471,348 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

A design pattern for managing the activation and deactivation of menus and buttons etc in an application

Hi all,

Does anyone know of a design pattern to deal with the issue of making UI
controls active and inactive according to the context of what the user is
doing?

I've been thinking about the best way to handle this but the only way I can
really think to do it would likely be very messy - trying to deal with it
in event handlers. I can imagine that trying to disable and enable buttons
and menu items and toolbars for a whole host of ui elements for a whole host
of different application contexts could be very messy.

Are there any particular approaches that i should be looking at to manage
the problem a bit better?

Thanks everyone

Simon

Jul 21 '05 #1
2 1867
This sort of functionality and the process of undo-redo can be managed using
the Command Pattern.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"thechaosengine" <na> wrote in message
news:21*********************@news.microsoft.com...
Hi all,

Does anyone know of a design pattern to deal with the issue of making UI
controls active and inactive according to the context of what the user is
doing?

I've been thinking about the best way to handle this but the only way I
can really think to do it would likely be very messy - trying to deal with
it in event handlers. I can imagine that trying to disable and enable
buttons and menu items and toolbars for a whole host of ui elements for a
whole host of different application contexts could be very messy.

Are there any particular approaches that i should be looking at to manage
the problem a bit better?

Thanks everyone

Simon

Jul 21 '05 #2
Set up a single handler that is called from the various postback events that
cause situtations that enable/disable controls. The basic design pattern is a
command pattern, but you will not likely go full bore on this, as you will
end up moving away from the UI or creating a rather complex page.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"thechaosengine" wrote:
Hi all,

Does anyone know of a design pattern to deal with the issue of making UI
controls active and inactive according to the context of what the user is
doing?

I've been thinking about the best way to handle this but the only way I can
really think to do it would likely be very messy - trying to deal with it
in event handlers. I can imagine that trying to disable and enable buttons
and menu items and toolbars for a whole host of ui elements for a whole host
of different application contexts could be very messy.

Are there any particular approaches that i should be looking at to manage
the problem a bit better?

Thanks everyone

Simon

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Torsten Wiebesiek | last post: by
10 posts views Thread by Saso Zagoranski | last post: by
2 posts views Thread by Matthew Hood | last post: by
1 post views Thread by Screenbert | last post: by
reply views Thread by YellowFin Announcements | last post: by
3 posts views Thread by Phillip Taylor | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.