Solved

DBGrid Onclick

Posted on 1997-11-13
5
543 Views
Last Modified: 2011-04-14
Since the DBGrid Object doesn't have an OnClick-Event,how do I know when it's clicked? And where?
PS. Can anybody help me on a book in which this sort of problem is dicussed? I'm getting tired of having to ask and bother you all the time,while there's some book with the solutions already in it!
0
Comment
Question by:lizzzard
[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
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
Pegasus100397 earned 50 total points
ID: 1350352
Lizzard,

Interesting question!

Try this in the Private declarations

procedure WMMouseActivate(VAR Msg)
    message WM_MOUSEACTIVATE

then

procedure TForm1.WM_MOUSEACTIVATE(Var Msg);
Begin
Form1.Caption := 'Mouse clicked!';
end;

you could expand this to indicate which control sent the click but it works well on my dbGrid :)

One of the best books for offbeat, strange Delphi solutions is:
DELPHI PROGRAMMING PROBLEM SOLVER
by Neil Rubenking
ISBN #1-56884-795-5

Good luck with your project!
Pegasus

0
 

Author Comment

by:lizzzard
ID: 1350353
Dear Pegasus,

Thanks for your answer and I almost got it working except for on e thing..:)
The click on the dbgrid is to check or uncheck a checkbox that is on it. In order to write the code for updating the physical field and the checkboxdrawing I'll have to know what column was clicked. If I try to use dbgrid.selectedfield.fieldname it's always 1 click behind on the Tform.WM_MOUSEACTIVATE event you suggested,so in the code fired by the click I still don't know wether or not to update the field. Or have I done this al wrong in the first place? Please help me...

Regards Lizzzard (alexg@molyvos.net)
0
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1350354
Lizzzard,

Sorry for the long time to reply, I've been out with the flu for a week or two. Look in the Win32s help file for the WM_MOUSEACTIVATE keyword and it will show you how to determine not only what the mouse action was, but WHO (or what in this case, like a column) actually sent the click message. If you get into a bind or can't understand it lemme know and I'll hunt down some examples.

By the way, why do the checkboxes in the grid NOT work? They should work by default unless the column is disabled or marked as read-only. Let me know

Thanks & good luck!
Pegasus
0
 

Author Comment

by:lizzzard
ID: 1350355
Hi Pegasus,

Hope you're better now (lots of orangejuice?). Thanks for your comment. I managed to get it working and it works great!
I only programmed 4GL till a vew months ago, Then I started with Delphi and at first I was hopelessly lost in 3GL language. But now things start to work out and I really enjoy programming Delphi.
Thanks for all the good advices!

Lizzzard
0
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1350356
Heya Lizzzard,

Glad to hear the problem is solved! Also glad to hear you *started* programming in Delphi instead of a real-language wanna-be like Visual Basis hehehaha Everything you learn with Delphi will only lead you to be utterly dissappointed with the limitations of other languages ;^D

Pegasus
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

719 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