ActionLists?

R

Rob Pollard

Hi All,
(You guys must be getting bored of me asking questions here!). In Delphi
(and other windows development) one can create action lists. These hold a
list of actions which encapsulate an event sink, an icon and text
representing the functionality of that sink as well as other useful
attributes such as whether the sink is enabled or not. These action lists
were great as you could set the various controls on your form to use
particular actions. Once a control was allocated an action that control's
text field, icon and event handler were set to those of the actionlist.

The big advantage with the above approach is that you could (for instance)
have a main menu entry, a speed menu entry and even a toolbar button all
point to the same action. This has the effect of assuring that the
functionality for a an action only need be written once and if an attribute
is changed on the action (such as the enabled property) all the other
controls using that action take on the new attribute change.

As far as I can tell C# has no actionlists in it (at least as far as my
standard edition is concerned). Is there a new .net replacement or
equivalent?

Thanks
RobP
'There are only 10 types of people in this world - Those that understand
binary and those that don't'
 
D

DC

I have no idea Delphi and actionlists but I wouls assume that what you are
after is the event/delgate model.
Delegates are essentially an objects that encapsulate a 'function pointer'.
If you want to register the same action on a context menu and 'main' menu,
create the delegate explicitly and add it to both events.

e.g

EventHanlder menuHandler = new EventHandler(handleMenuClick);
contextMenuItem.Click += menuHandler;
mainMenuItem.Click += menuHandler;
 
R

Rob Pollard

Hi Hadi,
That was just what I'm looking for. I'm so suprised that c# doesn't come
with this by default as it helps produce consistent UI's.

Thanks for your help

RobP
'There are only 10 types of people in this world - Those that understand
binary and those that don't'
 
J

Joanna Carter [TeamB]

"Rob Pollard" <[email protected]> a écrit dans le message de [email protected]...

| That was just what I'm looking for. I'm so suprised that c# doesn't come
| with this by default as it helps produce consistent UI's.

Action Lists are not part of the Delphi language, they are components
provided as part of the VCL. C# doesn't have any "components", however the
FCL does, but it does not provide a direct replacement. However, it is such
a simple concept to implement and, sure enough, as Hadi points out, someone
has already done this.

Joanna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top