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

x
?
Solved

DBGrid Onclick

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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