July 20th, 2012, 02:13 AM
Delphi and dbgrid
I have a dbgrid. If i click on a line a populate a textbox with somedata out of the grid. Works nice i use the oncellclick event. now on the far left you have an arrow wich you can use to select a line in the grid. only problem is it doe snot reconize the onclick event if you click there so there for my textbox dont get any info on it.
I dont know really what to search for on the net or how to explain it beter.
July 20th, 2012, 08:19 AM
I'm assuming you are talking about the arrow that is within the dbgrid. That "column" is not a cell based on a field in your database so that is why the oncellclick is not firing.
Perhaps you can use the "AfterScroll" event of your table/query component, and populate the textbox with a default field value from the new record. One drawback is if you click the arrow on the currently selected row, the event won't fire.
July 20th, 2012, 11:07 AM
Thanks.I used the mouse over.Some reason that work!!
Thanks for your help in anycase.Much appreciate it!!
July 20th, 2012, 03:30 PM
Somewhat off topic observation you should feel free to ignore
My own personal experience over many years is that using dbGrids with SQL databases
for anything other than read only displays or simple editing situations (like maintaining lookup tables),
eventually comes back to bite me.
The extra effort involved in using grids that are not db aware and managing the database
interaction myself has paid off handsomely.