?
Solved

DBGrid Onclick

Posted on 1997-11-13
5
Medium Priority
?
553 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 150 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

Technology Partners: 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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