Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid and Double-Click Event
Message
 
 
To
19/06/2001 12:41:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00520905
Message ID:
00521136
Views:
22
Hi Lutz,

Do you know about a way to do it in design time? I have the similar code in the grid class, but it would be much better to just place the grid one the form, and it already has our own text control instead of the standard one. When you can work on grid in design time (add some specific code, etc.).

>>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
>*Pretend the new grid and control is placed in the same classlib
> 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 &&MyTextBox.CLICK()
>*also for other relevant Events
>...
>
>PROCEDURE MyGrid.CLICK()
> PARAMETERS;
>  toColumn
>
>*Event calls Method
> 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()
>
>*also for other relevant Events
>
>
>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
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform