Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-04-02
4
Medium Priority
?
1,171 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

609 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