Re: GRID Click Event Fires Only Once



When you close a grid's recordsource, it deconstructs. When you use it
again, it reconstructs using default controls so YOUR CODE IS GONE!

Your best bet is to take the code *out* of the grid and put it in a textbox
class of your own making. That way you can call column.addobject() each time
you use the grid and MAKE SURE your code is there.

Dan

Gerhard Gentele wrote:
Hello Dan,
thanks for the advice - but it doesn't work. Here the steps I make:

PART1:
I have ha GRID on a form set to visible=.f.
I open a table TESTTABLE
I bind the GRID to the table with GRID1.RECORDSOURCE= "TESTTABLE"
and make the GRID visible.
Now I have a little routine in GRID1 -> COLUMN2 -> TEXT1 -> CLICK
THIS CLICKEVENT ROUTINE NOW WORKS FINE

PART2:
next I tell the the GRID that the RECORDSOURCE is "" with
GRID1.RECORDSOURCE=""
now I close the table with CLOSE DATABASE

PART3:
I do the things described in PART1 again and the CLICKEVENT doesn't do
anything anymore and I have the question: WHAT WENT WRONG?

Greetings Gerhard



"Dan Freeman" <spam@xxxxxxxxxxxxx> schrieb im Newsbeitrag
news:%23taIHck0IHA.4040@xxxxxxxxxxxxxxxxxxxxxxx
The event still fires, but your code is gone because you've closed
the grid's data source. When you do that, the grid deconstructs.

Set the recordsource to "" before closing the table. Or, better yet,
don't close it. <g>

Dan

Gerhard Gentele wrote:
Hello Friends,
now I started using a GRID. It has two columns and uses as
RECORDSOURCE a DBF table. With a click i can change a .T. to .F. and
back again. Everything works fine until I close the table and make
the GRID unvisible. Starting everything again the same way brings
back the GRID, but the ability to fire an EVENT (such like a CLICK
or a RIGHTCLICK) is not possible anymore - it's gone...
CAN ANYBODY TELL ME WHY?

Greetings Gerhard


.



Relevant Pages

  • Re: Grid und RecordSource Zuweisung
    ... Dem GRID wird zuvor die RecordSource ... entzogen und nach der Erstellung der Tabelle wieder zugewiesen. ... When you want to preserve the previous settings, for example, in scenarios when the new record source has the same structure as the previous one, you can use the SPACEfunction set the RecordSource property temporarily to SPACE. ...
    (microsoft.public.de.fox)
  • Re: Trapping Mouse Click on a grid
    ... Each grid column has a ControlSource property ... which contains the name of the field in the recordsource that populates the ... Each control, normally a textbox, also has a ControlSource property, ... the active row. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Datenquelle wechseln
    ... RecordSource des Grid auf die neue Datei einstellen ... Damit ist das Grid nie ohne RecordSource. ...
    (microsoft.public.de.fox)
  • Re: Grid event code content disappears after recordsource changed
    ... Your code inside the grid vanishes when you change the recordsource? ... I think you should change where you are putting your RECORDSOURCE change ... from the Init to the Activate and this should fix your problem. ... established within this init event. ...
    (microsoft.public.fox.vfp.forms)
  • Re: Cursor in Grid
    ... As a grid refreshes, it automatically changes the work area to its ... Microsoft Visual FoxPro MVP ... > But there is no command to change work area, ... >> If you need to advertise the alias of the RecordSource of a particlar ...
    (microsoft.public.fox.programmer.exchange)