Solved

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

Posted on 2009-04-02
4
1,164 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 75 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 37

Accepted Solution

by:
Geert Gruwez earned 175 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Base1 Encode/Decode 3 98
Convert MS Word document to a PDF file 9 133
DBCtrlGrid, Delphi, Scroll 8 83
How to add columns to a RAD Studio FMX grid at design time 1 58
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

737 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