CslaActionExtender features question/request

CslaActionExtender features question/request

Old forum URL: forums.lhotka.net/forums/t/6993.aspx


Michael posted on Sunday, May 24, 2009

Hi Rocky and Miguel and everyone else

I use OK, Cancel and Apply buttons for my screens which generally equate to the action extender's SaveAndClose, CancelAndClose, and SaveAndRebind, respectively.

There are a couple of things that may be missing, however. I currently have:


btnApply.Enabled = m_object.IsSavable;
btnOK   .Enabled =
m_object.IsValid;

If the object has not been edited, the OK button calls Close(). What I need is an option to DisableWhenNotSavable and another one to DisableWhenNotValid. In an earlier version, OK was only enabled when the object was saveable, but my users prefer to click OK rather than Cancel, even when they haven't changed anything.

Also, my screens are UserControls rather than forms so Close() fires an event which is handled by the main form. It would be great if the AndClose post save action could do something like GetCloseableParent rather than GetParentForm, where the result is either a Form or an ICloseable (a new interface exposing
void Close()).

I also can't get the action extender to DisableWhenClean when a child object changes (in 3.6.2).

Regards
Michael

miguelcastro67 replied on Tuesday, May 26, 2009

Hey Michael.
The enabling/disabling feature has always been tied to just dirtiness with this component, but I do like the idea of "when not savable" and "when not valid". Let me throw it around in my head and discuss with the Rockster and perhaps I can accommodate you. Regarding your "closing" issue: I certainly can see your point if your using UserControls, and UserControls would probably be my technique as well. I'll have to think about the best approach here, but I'll tell you what; at minimum I can throw a "close" event that you can then handle or bubble up - sound good?

I just fixed the last issue for child object changes so it'll be out in Rocky's next build (I suspect 3.6.3).

Please keep in mind that none of the other stuff mentioned above is making it to that build so I'll try to target the one following for some kind of solution to these problems.

Thanks,
Miguel

RockfordLhotka replied on Tuesday, May 26, 2009

This is where XAML is so much nicer, because the coupling between components is looser and is handled through data binding...

I wonder, though, if we can't take a page from XAML and apply it here - in a sense.

Perhaps it would be possible to design CslaActionExtender to be subclassed, such that someone could override the methods that enable/disable each button. That would allow them to replace the rules governing the enable/disable process?

I do like the Close event. I also create all my forms as UserControl objects - I can't remember that last time I created a Form that actually did anything beyond act as a container - and so totally support a solution that makes the UserControl model work well.

PederSvaleng replied on Monday, February 22, 2010

I'm trying to use the CslaActionExtender with usercontrols that enherits from WinPart (like in the ProjectTracker). If I bind the close button to the Close action my entire app closes. 

Does the CslaActionExtender support this action? If not, is there a workaround?

Thank you! 

Copyright (c) Marimer LLC