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.

Single-click sort and column drag and drop in GDBG

Thread ID:

Created:

Updated:

Platform:

Replies:

9676 Jan 6,2004 12:12 PM Mar 16,2005 06:48 PM Windows Forms 11
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 6, 2004 12:08 PM

I assume you will drag the column without first selecting it, is that correct? The default support for column moving within the grid is to first select a column (or several columns), and then mousedown and drag them. But if you want a single click to sort, then you would not have a single click available to select a single column so it would later be draggable. So, to get this behavior, I think you have at least two options to try. One is to derive your own custom mouse controller, and the other is to catch the MouseDown on the header, and track it to determine whether it is part of a sort click or a column move. If it is a column move, then you would have to manage the UI at this point to complete the drag to a new column. If you get stuck and need help doing it, post again or submit a Direct Trac support incident, and maybe we can work up a little sample.

Gene Gorokhovsky
Replied On January 6, 2004 12:12 PM

We use GDBG v 1.6.1.6. One of the application requirements is to allow both single-click sorting and column drag-and-drop moving similarly to Microsoft's explorer-like listview. How do we implement this behavior? Thanks, Gene Gorokhovsky

Gene Gorokhovsky
Replied On January 7, 2004 07:51 AM

> I assume you will drag the column without first selecting it, is that correct? yes. > So, to get this behavior, I think you have at least two options to try. One is to derive your own custom mouse controller, and the other is to catch the MouseDown on the header > If you get stuck and need help doing it, post again or submit a Direct Trac support incident, and maybe we can work up a little sample. I took a look at the grid's internal MouseControllers and neither of the suggested ways look sufficiently straightforward for me to try it on my own, so an example would defintely be much appreciated. The "grouping preview" seems to have the behavior closest to what is required, but source code for it ios not available. So, please, consider this post official "request for example". I can open a DirectTrac if will give the request higher priority. Thanks, Gene

Administrator [Syncfusion]
Replied On January 7, 2004 03:15 PM

The GridGroupingControl code with its draggable header cells is available in the 2.0.1.0 beta release. Here is one implementation that uses a derived grid, handling the mouse events to manage the move. It only uses cursors to give feedback during the move. You could do something fancier, dragging a transparent bitmap or something. There is a static method in the grid, GridUtil.DrawDragRectHelper, that you can use to implement better feedback.

Administrator [Syncfusion]
Replied On January 8, 2004 12:23 PM

They are two different controls. If you need to use features in the GridGroupingControl, you will have to swap out your GridDataBoundGrid''s with GridGroupingControls, and there will be coding changes required. The GridDataBoundGrid is still a supported control, and may be the grid of choice depending upon the exact functionality you need.

Gene Gorokhovsky
Replied On January 8, 2004 12:36 PM

Terrific! This is exactly what I needed. Does GridGroupingControl obsolete GridDataBoundGrid or does it augment it? Gene > The GridGroupingControl code with its draggable header cells is available in the 2.0.1.0 beta release. > > Here is one implementation that uses a derived grid, handling the mouse events to manage the move. It only uses cursors to give feedback during the move. You could do something fancier, dragging a transparent bitmap or something. There is a static method in the grid, GridUtil.DrawDragRectHelper, that you can use to implement better feedback. > > >

Gene Gorokhovsky
Replied On January 8, 2004 12:36 PM

Terrific! This is exactly what I needed. Does GridGroupingControl obsolete GridDataBoundGrid or does it augment it? Gene > The GridGroupingControl code with its draggable header cells is available in the 2.0.1.0 beta release. > > Here is one implementation that uses a derived grid, handling the mouse events to manage the move. It only uses cursors to give feedback during the move. You could do something fancier, dragging a transparent bitmap or something. There is a static method in the grid, GridUtil.DrawDragRectHelper, that you can use to implement better feedback. > > >

Gene Gorokhovsky
Replied On January 8, 2004 12:47 PM

> You could do something fancier, dragging a transparent bitmap or something. There is a static method in the grid, GridUtil.DrawDragRectHelper, that you can use to implement better feedback. DrawDragRectHelper is in GridPaint, and it is an internal class, so even public statics are not available outside the assembly, but cut and paste does wonders! Gene

Suraj Tamboli
Replied On September 20, 2004 01:19 PM

In this sample there is bug. When you resize a column it moves the column too. Do you have any fix for this ? Thanks, >The GridGroupingControl code with its draggable header cells is available in the 2.0.1.0 beta release. > >Here is one implementation that uses a derived grid, handling the mouse events to manage the move. It only uses cursors to give feedback during the move. You could do something fancier, dragging a transparent bitmap or something. There is a static method in the grid, GridUtil.DrawDragRectHelper, that you can use to implement better feedback. > > >

Administrator [Syncfusion]
Replied On September 20, 2004 02:06 PM

Hi Suraj, The following changes prevent that from happening: protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e) { int ht = this.HitTest(new Point(e.X, e.Y)); if (ht == GridHitTestContext.Header) this.mouseDownPt = new Point(e.X, e.Y); else this.mouseDownPt = Point.Empty; base.OnMouseDown(e); } and in OnMouseMove the first line: if(e.Button == MouseButtons.Left && !this.mouseDownPt.IsEmpty) Stefan

mowmow
Replied On March 16, 2005 11:21 AM

I am using a GridControl. The Drag and drop of the columns with a single click works fine, but I want to be able to show that a column is actually dragged (Something similar to way column are dragged on the GridGroupingControl with the column header transparent attached to the mouse). As I understood, GridUtil.DrawDragRectHelper would allow to do something like that, but, it is not documented and I have not been able to figure how it could be used... Ams >> You could do something fancier, dragging a transparent bitmap or something. There is a static method in the grid, GridUtil.DrawDragRectHelper, that you can use to implement better feedback. > > > >DrawDragRectHelper is in GridPaint, and it is an internal class, so even public statics are not available outside the assembly, but cut and paste does wonders! > >Gene > > > >

Administrator [Syncfusion]
Replied On March 16, 2005 06:48 PM

Here is a link to a little sample using the drag helper class. http://www.syncfusion.com/Support/user/uploads/forum_DragColumn_dcac527f.zip

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.

;