Purer CSS output from ASP.NET 2.0 Next Post

Ok, this is old. However, Delphi actions (available from Delphi 4 on circa 1998) were so unbelievably useful that I still can’t believe they haven’t made it into a .NET framework near you. Evidently I’m not the only one – even if I’m up to four years behind in actually sourcing one of several C# implementations ;)

The use of IExtenderProvider is probably more novel to me than the (reasonably faithful) implementation this provides – the Delphi VCL baked Action support in at a Control level, so buttons/menu items/tool buttons all had an Action property which could be hooked up (via a design-time dropdown) to any of the actions held in any number of non-visual TActionList components in the same container. If you wanted to disable an action/put a check next to it/change its image via a TImageList, you would do this on the action object and the change would propagate to every linked control.

The Delphi IDE provided support for various standard Windows descendants of TBasicAction, concerned with common actions such as cut/paste, File open, etc. You could derive and register your own actions with the IDE, and each action had both an Execute method (which could be overridden) and an OnExecute event. This meant if you were just using a basic action you didn’t have to derive a whole new class, you could just respond to the OnExecute event.

Both Actions and ActionLists also had an OnUpdate event which was triggered when the windows application was idle. This gave both an ideal time and place for centralising code to enable/disable parts of the application’s interface based on the state of the entire form.

These days I do most of my application development in web applications. I’m currently wondering whether it’s worth porting actions for web apps, as “form state” has both a JavaScript (shudder) client aspect and a server-side aspect, though maybe I could do this entirely on the client side (double shudder). There are other more minor problems to solve: notably, the Delphi-style actions link to images using an index into a TImageList – I’d need both a TWinAction and a TWebAction that linked to images in different ways. I’d also need to enforce some design-time behaviour with respect to web image storage.

One Response to “Delphi-style actions in C#”

  1. [...] Jelle Druyts has written a Windows Presentation Foundation article on the decoupling of UI elements from the underlying code they invoke. This means my previous disbelief at this kind of thing not making it into .NET frameworks is soon to be null and void [...]

Leave a Reply

(required)

(required)

© 2014 ZephyrBlog Suffusion theme by Sayontan Sinha