ActionLists?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Pollard

    ActionLists?

    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'


  • DC

    #2
    Re: ActionLists?

    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(ha ndleMenuClick);
    contextMenuItem .Click += menuHandler;
    mainMenuItem.Cl ick += menuHandler;


    "Rob Pollard" <robertapollard @hotmail.comwro te in message
    news:lnF_g.2012 7$3D1.13392@fe3 .news.blueyonde r.co.uk...
    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'
    >

    Comment

    • Hadi Hariri

      #3
      Re: ActionLists?

      Rob,

      There are ActionList implementations on Code Project. Here is one in
      particular:





      --


      Comment

      • Rob Pollard

        #4
        Re: ActionLists?

        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'
        <Hadi Haririwrote in message news:uJsvxKc9GH A.4476@TK2MSFTN GP04.phx.gbl...
        Rob,
        >
        There are ActionList implementations on Code Project. Here is one in
        particular:
        >

        >
        >
        >
        --

        http://www.malagadnug.org

        Comment

        • Joanna Carter [TeamB]

          #5
          Re: ActionLists?

          "Rob Pollard" <robertapollard @hotmail.coma écrit dans le message de news:
          04I_g.4974$3x1. 3089@fe1.news.b lueyonder.co.uk ...

          | 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

          --
          Joanna Carter [TeamB]
          Consultant Software Engineer


          Comment

          Working...