Author |
Share Topic Topic Search Topic Options
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Topic: [CANCELLED] Adding an Item to the PageNavigatorAdapter Posted: 16-Dec-2007 at 10:20pm |
Yes you are right. Thanks!
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 14-Dec-2007 at 9:00am |
Thanks, me too. For now, I have given up on this particular item. Too many other things to concentrate on at the moment.
The whole CAB/DF thing is lightly supported through IdeaBlade. Hopefully, as the days and months waddle by, more resources can be applied to this area. Thanks a lot for your input. That is another hope of mine...that more users will interact with these forums. Shared experiences are quite beneficial in the development process.
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 13-Dec-2007 at 10:56pm |
Ok. I hope you will make it work. :)
By the way, Where are the Ideablade Support? :)
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 13-Dec-2007 at 8:44am |
Somehow a UI extension site might fit in here...I just can't get my head around it, yet.
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 9:03pm |
Oh ok. I get it. :) Nope. I think its do-able but I must admit it's hard implementing it in CAB :)
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 8:34pm |
mykel, thanks gobs for the response. Two thumbs up!
My gut is telling me that fiddling with the interfaces on this Adapter is not the way to go, though. The toolbar's Button.Add functionality (for example) should be exposed so that the user control can add to its basic set of items (Print Report Button, Drop-Down List Control for filtering data, Simple label control for information, etc.). Adding the proper handler would be module specific. Your undo example is good and I understand the work involved in making it happen (for the most part); however, an ad hoc toolbar item is what I would like to achieve. Perhaps, I am dreaming a little too much, eh?
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 8:10pm |
oh Im sorry, I forgot about the PageController class. You need to add the ff in the PageController, before doing something in the SummaryDetailPageController:
#region Undo Item
/// <summary>Handle request to undo an item.</summary>
protected void UndoItemHandler(object sender, EventArgs<Object> e)
{
// ToDo: Use Resources
object item = e.Data;
UndoItem(item);
}
/// <summary>Delete the item.</summary>
/// <remarks>
/// This implementation can only delete
/// an <see cref="Entity"/>.
/// </remarks>
protected virtual void UndoItem(object pItem)
{
if (pItem is Entity)
{
(( Entity)pItem).Undo();
(( Entity)pItem).ClearErrors();
(( CommonEntity)pItem).VerifierResults.Clear();
}
else
{
throw new InvalidOperationException("Can't undo an item of type, " + pItem.GetType());
}
}
#endregion
Note that this is only my example for creating an undo functionality. You have to modify the code inside the methods and events in order to implement the functionality of your toolbar button event once you click it.
I think thats all. I am sorry if ever I missed out something. Let me know if you encounter problems with this.
Hope this helps. :)
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 8:05pm |
And then in the generic PageController (ex. SummaryDetailPageController<TRootObject>) you configure the events of your added toolbar.
/// <summary>Configure the UndoItem button.</summary>
protected virtual void ConfigureUndoItemButton()
{
PageToolBar.UndoItemClick += UndoItemHandler;
}
then call this event in the AddCommandHandlers() method.
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 8:01pm |
Once you added this, Now you have to place a setting code in the DevExPageView CreateNavigatorAdapter() method:
navAdapter.UndoItemButton = undoCurrentToolStripMenuItem;
given that the undoCurrentToolStripMenuItem is the ToolStripItem button you added in your UI.
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 7:58pm |
Then in the PageNavigatorAdapter, You have to add the ff methods and variables:
private ToolStripItem mUndoItemButton;
// <summary>Raised on UndoItem click.</summary>
public event EventHandler<EventArgs<Object>> UndoItemClick;
/// <summary>Set the ToolStripItem that represents the UndoItem Button.</summary>
/// <remarks>
/// Derived classes can "get" this ToolStripItem.
/// </remarks>
public ToolStripItem UndoItemButton
{
protected get { return mUndoItemButton; }
set
{
SetButton( ref mUndoItemButton, value, UndoItemButtonClick);
}
}
private void UndoItemButtonClick(object sender, EventArgs e)
{
InvokeClickHandlerWithCurrentObject(UndoItemClick, true);
}
/// <summary>Get or set the visible state of the Undo button.</summary>
public bool UndoItemVisible
{
get { return GetToolStripItemVisible(UndoAllButton); }
set { SetToolStripItemVisible(UndoAllButton, value); }
}
/// <summary>Get or set the enabled state of the Undo button.</summary>
public bool UndoItemEnabled
{
get { return GetToolStripItemEnabled(UndoItemButton); }
set { SetToolStripItemEnabled(UndoItemButton, value); }
}
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 7:55pm |
In the IPageViewToolBar interface, you need to add the following getter and setter of the function you want to add. In my application, I added an Undo functionality and add the following codes:
/// <summary>Get or set the enabled state of the UndoItem button.</summary>
bool UndoItemEnabled { get; set;}
/// <summary>Get or set the visible state of the UndoItem button.</summary>
bool UndoItemVisible { get; set;}
/// <summary>Raised on UndoItem click.</summary>
event EventHandler<EventArgs<Object>> UndoItemClick;
Take note that you will only add the Enabled and Visible codes, if you will need to manipulate the behavior of your control. But the event handler is an important thing here.
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 7:52pm |
You first add the toolStripItem in the Toolbar of the DevExPageView Form. then take note of the CreateNavigatorAdapter() method inside the code of the form, because you will be setting your newly added button from the PageNavigatorAdapter into the ToolStripItem control.
|
|
mykel
Newbie
Joined: 18-Sep-2007
Location: Philippines
Posts: 30
|
Post Options
Quote Reply
Posted: 12-Dec-2007 at 7:46pm |
I think I can help you with this, linguinut (i hope) :) do you still want to hear?
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 06-Dec-2007 at 2:24pm |
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 05-Dec-2007 at 11:04am |
|
|
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 04-Dec-2007 at 6:07pm |
|
|