Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6931573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:35:43+00:00 2026-05-27T11:35:43+00:00

In a TDbGrid.OnColumnMoved event handler, I adjust some column headings colors. I also use

  • 0

In a TDbGrid.OnColumnMoved event handler, I adjust some column headings colors.

I also use the grid’s OnTitleClicked event to pop-up a (sort column) menu.

Unfortunately, after the user drags a column and OnColumnMoved is finished, the VCL calls OnTitleClicked. This means my sort-order pop-up appears after column dragging.

Is there a way in OnColumnMoved I can clear the mouse event queue so that OnTitleClicked doesn’t get called?

This thread has this code, but I don’t have a Msg in OnTitleClicked.

while PeekMessage(Msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, 
  PM_REMOVE or PM_NOYIELD) do;

(If there’s no way to do this, it’s not big deal. I can set a flag in OnColumnMoved so that OnTitleClick ignores the next call to it.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:35:44+00:00Added an answer on May 27, 2026 at 11:35 am

    As mentioned in comments to the question, you would supply the ‘Msg’ for PeekMessage yourself (var Msg: TMsg). But discarding the message that triggers OnTitleClickis not possible because it is the same message that fires both events. VCL carries out column moving in response to a WM_LBUTTONUP message if a column has been dragged. Later during the handling of the same message OnTitleClick is called.

    IOW, while you can remove messages from the message queue with PeekMessage, the message that triggers OnTitleClick is already dispatched since we are in an OnColumnMoved handler.

    Easiest approach looks like setting the flag as you’ve told.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a simple method to sort column in TDBGrid. If Option.RowSelect set to
I'm planning to write an un-do feature for use in a TDBGrid hooked up
I have a TDbGrid, and I can easily tell how many columns are in
I'm trying to populate a TDBGrid with the results of the following TQuery against
Is there any way to copy a selection of rows from a TDBGrid in
I am trying to synchronize the scrolling of two TDBGrid components in a VCL
I have a TDBGrid and have a Client dataset associated through a TDataSource. When
is it possible to set a TDBGrid (or TwwDBGrid) cell ReadOnly in Delphi? Currently
I want to activate a cell in a TDBGrid by code. By activate I
To make certain form creation easier, we use a modified Formview control that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.