>Grid dblclick would work if dblclicked in a dead area (gridlines, after recs etc). Other times dblclick of controls would work. It's cumbersome to add functioanlity to all controls to call grid's click. Instead you can control it from one place :) Place a transparent container in front of grid. In dblclick put your code but be sure to test where you're with gridhittest and activate clicked row first to get correct PK. Instead of activating you could temporarily set visibility of container to .f. and do a click at the same location.
>Cetin
Cetin,
you are right, this is a lot of work to funnel all importend events to the Grid.
But to add extra controls to my form means I need extra work to resize and so one.
May forms regularly have more than one grid, I would die one each way.
But what about code? We do programming to make customers life easier.
Why not ours?
I never do this manually.
There are powerfull tools like subclassing, ASSIGN methods and so one.
I have specialized control classes and a specialized grid class.
All to do is some code in thoses classes to clean up the original textbox and add the new control.
LOCAL;
lnLoop,;
loColumn,;
lcCurrentControl
IF NOT UPPER(THIS.CLASSLIBRARY) $ UPPER(SET("CLASSLIB")) THEN
SET CLASSLIB TO (THIS.CLASSLIBRARY) ADDITIVE
ENDIF
...
FOR lnLoop = 1 TO THIS.COLUMCOUNT
loColumn = THIS.COLUMNS(lnLoop)
lcCurrentControl = loColumn.CURRENTCONTROL
loColumn.REMOVEOBJECT(lcCurrentControl )
loColumn.ADDOBJECT(lcCurrentControl,THIS.gcNewControl)
ENDFOR lnLoop
...
Do this within INIT() and within a ASSIGN Method for COLUMNCOUNT().
Transporting design time settings for FORMAT etc. may be done in this loop. (Not may way, I want programmatic control)
And if you do the events like:
PROCEDURE MyTextBox.CLICK()
THIS.PARENT.PARENT.CLICK(THIS.PARENT)
ENDPROC
...
PROCEDURE MyGrid.CLICK()
PARAMETERS;
toColumn
IF VARTYPE(toColumn)='O' THEN
THIS.Clicked_Column(toColumn)
ELSE
THIS.Clicked_Grid()
ENDIF VARTYPE(toColumn)='O'
ENDPROC MyGrid.CLICK()
PROCEDURE MyGrid.Clicked_Column()
PARAMETERS;
toColumn
ENDPROC MyGrid.CLICK()
PROCEDURE MyGrid.Clicked_Grid()
ENDPROC MyGrid.CLICK()
it is just on your fingertips to respond to the column an event fired and a click on the grid as well.
.
Now you are completely free to add the grid to your form.
Lutz