We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Grid- Treecell

Thread ID:

Created:

Updated:

Platform:

Replies:

41293 Feb 27,2006 09:47 AM Mar 8,2006 06:10 AM Windows Forms 8
loading
Tags: GridControl
Ravichandran Raman
Asked On February 27, 2006 09:47 AM

Hi I have a sync grid in my form with one column as TreeCell. ( CellType="TreeCell") It is a custom cell type. I am getting the records in tree structure with ( + and - Sign). But when I start the selection from the column which has treecell type, I could not. But selection is working if it starts from other non tree column. Please find attached the screen shot and description in word document. PS: Selection - Holding the right mouse button and dragging.

TreeCell.zip

Ravichandran Raman
Replied On February 27, 2006 10:07 AM

Hi any one pls help me >Hi > >I have a sync grid in my form with one column as TreeCell. ( CellType="TreeCell") It is a custom cell type. I am getting the records in tree structure with ( + and - Sign). > But when I start the selection from the column which has treecell type, I could not. >But selection is working if it starts from other non tree column. > >Please find attached the screen shot and description in word document. > >PS: Selection - Holding the right mouse button and dragging.

TreeCell.zip

stanleyj [Syncfusion]
Replied On February 27, 2006 10:16 AM

Hi RaviChandran, You can then have the row header by modifying the QueryColWidth handler to make selections by dragging the rowheader. void GridQueryColWidth(object sender, GridRowColSizeEventArgs e) { if( e.Index == 1) e.Size = 200; else if (e.Index > 0) e.Size = 100; else e.Size = 30; e.Handled = true; } Best regards, Stanley

Ravichandran Raman
Replied On February 27, 2006 11:05 AM

Hi Stanley, Thanks. But I dont want to my selection from header. Anywhere from the mid of the grid data but starts with the column which has tree node. But if I start the selection from next col (non tree col) then I could. Once I click on tree cell col and hold the right mouse button no selection happens. Regards Ravi >Hi RaviChandran, > >You can then have the row header by modifying the QueryColWidth handler to make selections by dragging the rowheader. > > void GridQueryColWidth(object sender, GridRowColSizeEventArgs e) > { > if( e.Index == 1) > e.Size = 200; > else if (e.Index > 0) > e.Size = 100; > else > e.Size = 30; > > e.Handled = true; > } > > >Best regards, >Stanley

stanleyj [Syncfusion]
Replied On February 28, 2006 01:48 AM

Hi Ravi, You would have noticed how the +/- expands and collapses, though they are not cell buttons and have no specific events to be raised. Let me explain you little further, to help you understand why selecting a range was not possible to start with that TreeCell column. Mouse messages (OnMouseDown, OnMouseHover, OnMouseUp) are being called for the cell renderer because non-zero return value of OnHitTest if requested handles the mouse event, zero return does not handle the mouse events. In our customized cell type the ContextMenu and call to ClickTreeNode which acts like CellButtonClick are coded in MouseDown. Therefore it is important to have a non zero return in the OnHitTest overrides to have the ContextMenu and the responces to the MouseDown over the images. If the ContextMenu is really not needed and if you feel that is fine to expand and collapse only with the left mouse button, then Change this code to have selections with right mouse button. protected override int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller) { if(e.Button == MouseButtons.Left ) { //return a cell hit so OnMouseDown will be called later return GridHitTestContext.Cell; } else return 0; } Best regards, Stanley

Ravichandran Raman
Replied On February 28, 2006 08:15 AM

Hi Stanley, Thanks.I tried with the code piece you sent even that could not help me to start the selection from tree view col. Is there any other way to acheive pls let me know. I want the data in the grid has to be selected using normal selection ( how we do in word or text doc, by holding the right mouse button from the tree col) Thanks, Ravi. >Hi Ravi, > >You would have noticed how the +/- expands and collapses, though they are not cell buttons and have no specific events to be raised. Let me explain you little further, to help you understand why selecting a range was not possible to start with that TreeCell column. > >Mouse messages (OnMouseDown, OnMouseHover, OnMouseUp) are being called for the cell renderer because non-zero return value of OnHitTest if requested handles the mouse event, zero return does not handle the mouse events. > >In our customized cell type the ContextMenu and call to ClickTreeNode which acts like CellButtonClick are coded in MouseDown. Therefore it is important to have a non zero return in the OnHitTest overrides to have the ContextMenu and the responces to the MouseDown over the images. > >If the ContextMenu is really not needed and if you feel that is fine to expand and collapse only with the left mouse button, then Change this code to have selections with right mouse button. > > protected override int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller) > { > if(e.Button == MouseButtons.Left ) > { > //return a cell hit so OnMouseDown will be called later > return GridHitTestContext.Cell; > } > else > return 0; > } > > >Best regards, >Stanley

stanleyj [Syncfusion]
Replied On February 28, 2006 09:13 AM

Hi Ravi, Please take a look to the modified sample. Holding the right mouse button and dragging from the TreeCell column works to me. I do not know other way now, will let you know if there are other possibilities. Best regards, Stanley

Ravichandran Raman
Replied On March 1, 2006 06:34 AM

Hi Stanley, Your sample code is working fine. But if I use right mouse button instead of left mouse button (my original requirement is right mouse button only), I could not able to expand the tree view and grid_SaveCellInfo() event is not being fired which is actually used to expand the node the node. In your example also if you change the button to Right on OnHitTest event. You could not close the tree view. thanks and awaiting for your reply Ravi >Hi Ravi, > >Please take a look to the modified sample. Holding the right mouse button and dragging from the TreeCell column works to me. > >I do not know other way now, will let you know if there are other possibilities. > >Best regards, >Stanley

stanleyj [Syncfusion]
Replied On March 8, 2006 06:10 AM

Hi Ravi, Sorry for the delay, please try checking this condition to get the cells selected from the TreeView cell. protected override int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller) { if (e.X < 50) if (e.Button != MouseButtons.None) return GridHitTestContext.Cell; return 0; } This conditions helps for the selection while e.X > 50, hoping button like images are less than 50. Hope this might help at some point. Best regards, Stanley

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;