Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Drag & Drop Support

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Jimmy
Guest





PostPosted: Mon Dec 12, 2005 11:16 pm    Post subject: Drag & Drop Support Reply with quote

When using programatic data binding, where do you set

AllowDrag
AllowDropAboveRow
AllowDropBelowRow
AllowDropOnRow

so that the virtual tree supports drag & drop functionality.
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Dec 13, 2005 6:17 am    Post subject: Reply with quote

There are various events that you handle to manage drag and drop programmatically. See the documentation on the following:

GetAllowRowDrag
GetAllowedRowDropLocations
GetRowDropEffect
RowDrop
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Jimmy
Guest





PostPosted: Thu Jan 12, 2006 5:14 pm    Post subject: Drag & Drop Reply with quote

Guys,

I have two virtual trees, with programatic drag and drop support:

Here is the code for the first:

//
// _productTree
//
this._productTree.AllowDrop = true;
this._productTree.EnableDragSelect = false;
this._productTree.Columns.Add(this._colProductName);
this._productTree.Columns.Add(this._colProductDescription);
this._productTree.Columns.Add(this._colProductUnits);
this._productTree.Dock = System.Windows.Forms.DockStyle.Fill;
this._productTree.Editors.Add(this._universalEditor);
this._productTree.LineColor = System.Drawing.SystemColors.ControlDark;
this._productTree.LineStyle = Infralution.Controls.VirtualTree.LineStyle.Dot;
this._productTree.Location = new System.Drawing.Point(3, 3);
this._productTree.Name = "_productTree";
this._productTree.SelectionMode = Infralution.Controls.VirtualTree.SelectionMode.MainCellText;
this._productTree.Size = new System.Drawing.Size(183, 308);
this._productTree.TabIndex = 0;
this._productTree.ShowRootRow = false;
this._productTree.GetChildren += new Infralution.Controls.VirtualTree.GetChildrenHandler(this._productTree_GetChildren);
this._productTree.GetCellData += new Infralution.Controls.VirtualTree.GetCellDataHandler(this._productTree_GetCellData);
this._productTree.GetRowData += new Infralution.Controls.VirtualTree.GetRowDataHandler(this._productTree_GetRowData);
this._productTree.SetCellValue += new Infralution.Controls.VirtualTree.SetCellValueHandler(this._productTree_SetCellValue);
this._productTree.GetParent += new Infralution.Controls.VirtualTree.GetParentHandler(this._productTree_GetParent);
this._productTree.GetAllowRowDrag += new Infralution.Controls.VirtualTree.GetAllowRowDragHandler(this._productTree_GetAllowRowDrag);
this._productTree.GetAllowedRowDropLocations += new Infralution.Controls.VirtualTree.GetAllowedRowDropLocationsHandler(this._productTree_GetAllowedRowDropLocations);
this._productTree.GetRowDropEffect += new Infralution.Controls.VirtualTree.GetRowDropEffectHandler(this._productTree_GetRowDropEffect);
this._productTree.RowDrop += new Infralution.Controls.VirtualTree.RowDropHandler(this._productTree_RowDrop);


Here are the Product Tree Drag & Drop Event Handlers

private void _productTree_GetAllowRowDrag(object sender, GetAllowRowDragEventArgs e)
{
e.AllowDrag = true;
}

private void _productTree_GetAllowedRowDropLocations(object sender, GetAllowedRowDropLocationsEventArgs e)
{
e.AllowedDropLocations = RowDropLocation.BelowRow;
}

private void _productTree_GetRowDropEffect(object sender, GetRowDropEffectEventArgs e)
{
e.DropEffect = DragDropEffects.Copy;
}

private void _productTree_RowDrop(object sender, RowDropEventArgs e)
{
MessageBox.Show("Hello");
}

Here is the second tree:

//
// _categoryTree
//
this._categoryTree.AllowDrop = true;
this._categoryTree.EnableDragSelect = false;
this._categoryTree.Columns.Add(this._colCategoryName);
this._categoryTree.Columns.Add(this._colCategoryDescription);
this._categoryTree.Dock = System.Windows.Forms.DockStyle.Fill;
this._categoryTree.Editors.Add(this._universalEditor);
this._categoryTree.LineColor = System.Drawing.SystemColors.ControlDark;
this._categoryTree.LineStyle = Infralution.Controls.VirtualTree.LineStyle.Dot;
this._categoryTree.Location = new System.Drawing.Point(3, 3);
this._categoryTree.Name = "_productTree";
this._categoryTree.SelectionMode = Infralution.Controls.VirtualTree.SelectionMode.MainCellText;
this._categoryTree.Size = new System.Drawing.Size(183, 308);
this._categoryTree.TabIndex = 0;
this._categoryTree.ShowRootRow = false;
this._categoryTree.GetChildren += new Infralution.Controls.VirtualTree.GetChildrenHandler(this._categoryTree_GetChildren);
this._categoryTree.GetCellData += new Infralution.Controls.VirtualTree.GetCellDataHandler(this._categoryTree_GetCellData);
this._categoryTree.GetRowData += new Infralution.Controls.VirtualTree.GetRowDataHandler(this._categoryTree_GetRowData);
this._categoryTree.SetCellValue += new Infralution.Controls.VirtualTree.SetCellValueHandler(this._categoryTree_SetCellValue);
this._categoryTree.GetParent += new Infralution.Controls.VirtualTree.GetParentHandler(this._categoryTree_GetParent);
this._categoryTree.SelectionChanged += new System.EventHandler(this.SelectionChanged);
this._categoryTree.GetAllowedRowDropLocations += new Infralution.Controls.VirtualTree.GetAllowedRowDropLocationsHandler(this._categoryTree_GetAllowedRowDropLocations);
this._categoryTree.GetAllowRowDrag += new Infralution.Controls.VirtualTree.GetAllowRowDragHandler(this._categoryTree_GetAllowRowDrag);
this._productTree.GetRowDropEffect += new Infralution.Controls.VirtualTree.GetRowDropEffectHandler(this._categoryTree_GetRowDropEffect);
this._categoryTree.RowDrop += new Infralution.Controls.VirtualTree.RowDropHandler(this._categoryTree_RowDrop);


Here are the Category Tree Drag & Drop Event Handlers

private void _categoryTree_GetAllowRowDrag(object sender, GetAllowRowDragEventArgs e)
{
e.AllowDrag = true;
}

private void _categoryTree_GetAllowedRowDropLocations(object sender, GetAllowedRowDropLocationsEventArgs e)
{
e.AllowedDropLocations = RowDropLocation.BelowRow;
}

private void _categoryTree_GetRowDropEffect(object sender, GetRowDropEffectEventArgs e)
{
e.DropEffect = DragDropEffects.Copy;
}

private void _categoryTree_RowDrop(object sender, RowDropEventArgs e)
{
MessageBox.Show("Hello there");
}

For some reason I can drop items onto the product tree, however unable to drop anything onto the category tree (ie> _categoryTree_RowDrop(..) is never called..

Absolutly no idea why this is the case, any ideas there?
Much appreciated,
Jimmy.
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Jan 12, 2006 9:19 pm    Post subject: Reply with quote

I can't see anything obvious from the code you posted. If you could email a zipped copy of your project to support@infralution.com we will take a look at it.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Jimmy
Guest





PostPosted: Thu Jan 12, 2006 9:58 pm    Post subject: Reply with quote

Oops just figured it out, sorry about the post...

this._productTree.GetRowDropEffect += new Infralution.Controls.VirtualTree.GetRowDropEffectHandler(this._categoryTree_GetRowDropEffect);

shoud have been

this._categoryTree.GetRowDropEffect += new Infralution.Controls.VirtualTree.GetRowDropEffectHandler(this._categoryTree_GetRowDropEffect);
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group