?
Solved

Quantum Grid: How to incorporate both column-move and a header click event?

Posted on 2009-04-02
4
Medium Priority
?
1,169 Views
Last Modified: 2012-05-06
I am building an app that uses a DevExpress Quantum Grid and I want to give the user the ability to move the columns and to rename the caption in the column header.  I used the OnColumnHeaderClick to open a dialog box for renaming the column.  Now the dialog box opens immediately when the mouse button is depressed so there is no opportunity to drag the header to move the column.  I don't see an event for a double click in the header which would be an easy solution.  
  Can someone suggest how I might give the user an intuitive, column-specific mouse action that would open an InputBox as the dialog for the new column header caption while preserving the ability to drag columns to create a new column order?

Thanks.
0
Comment
Question by:ttheimer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Assisted Solution

by:Russell Libby
Russell Libby earned 300 total points
ID: 24056163

I have done a couple of feature rich apps using the Quantum Grid, and I know exactly what your talking about.

I offer the same rename capability (as well as a few other functions like hide column, auto-size, etc) and I ended up wiring up a popup menu that is fired on the right mb click on the column header. The user, if he choses the rename, is then shown a dialog with the current caption displayed and can change it at that point. Attempting to handle this directly in the left mb down is a bad idea IMHO, as it will interfere with the built in sorting and dragging.

Hth,
Russell
0
 

Author Comment

by:ttheimer
ID: 24056832
I would assume that you used the OnMouseDown event for the table view so how did you identify that you were on a header and to which column the header belonged?
0
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 700 total points
ID: 24057313
this is how to extend the quantumgrid rightclick menu

first thing: you need to add a TcxGridPopupMenu to the form
and assign the property Grid

next invoke the editor for the popupmenus and a new TcxPopupMenuInfo
and set it's properties:
The view it's for, when it will be visible you can set in the HitTypes property (your case: gvhtColumnHeader)
and then you add your own popupmenu

from your own popupmenu, you then can fire a inputbox to change the caption

that's the easy way, you could also extend the TcxGridTableCustomizationForm ... but that's more complex
procedure TForm1.OnPopColumnCaptionChangeClick(Sender: TObject);
var
  aColumnCaption: string;
  aView: TcxGridTableView;
begin
  aView := TableView1;
  aColumnCaption := aView.Controller.FocusedColumn.Caption;
  if InputQuery('Change column', 'Enter new title', aColumnCaption) then
    with aView.Controller do
    begin
      BeginUpdate;
      try
        FocusedColumn.Caption := aColumnCaption;
      finally
        EndUpdate;
      end;
    end;
end;

Open in new window

0
 

Author Comment

by:ttheimer
ID: 24059444
Geert_Gruwez:
  I followed your instructions and it all works!  The behavior that may have been disconcerting for the user is that a right-click on the header responds for the FocusedColumn and not the column that received the right click.  
   But "TcxGridColumnHeaderHitTest(AHitTest).Column" in he OnPopup event of the TcxGridPopupMenu object gives me the column receiving the right click so I was able to resolve this final issue.

Thanks for the help!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 19 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question