I have a grid that sits on the form. One of the columns is for Part
Number.
This grid is used for (data entry)

I have a seperate table that list the all known part numbers. I have a
search form that list the part numbers of this other table. This search
form has a grid of its own.

This setup allows the user to simply enter a known part number, double click
to fire the search form, or hit the question mark from the keyboard to fire
the search form.

When the user double-clicks, everything works great. The search form opens,
the user picks one part number from the search form. It then fills in the
row I was on with the selected value.

The problem is when I use the "?" question mark to fire the search form.
When the search form opens, it list the first 10 hits starting from the top
of the Part Number file.
As soon as I click the grid on the search form, the program crashes.

Error # 52, Line 0, Method: Grid1.mousedown
No table is open is the current work area.

This code is from the first grid (data entry grid). Its the textbox in the
PartNumber column.

* KeyPress Event
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 63 && ?
NODEFAULT
thisform.keycode_changed("")
ENDIF

* DblClick Event
thisform.keycode_changed("")


Has anyone seen a problem VFP crashing on a mousedown event of the a grid.
I have no code in the mousedown event to trigger an error. When I put a
messagebox line in this event, it never fires.


I appreciate any ideas....

Thx in advance,
Dan Tallent
--------------------------------

Re: VFP8, Grid crashing when line item is clicked by Olaf

Olaf
Thu Aug 25 10:26:09 CDT 2005


> Has anyone seen a problem VFP crashing on a mousedown event of the a grid.
> I have no code in the mousedown event to trigger an error. When I put a
> messagebox line in this event, it never fires.
It fires, if you click exactly on the grid lines (and/or grid border),
as those are the very thin parts of the grid being itself.

If you click on a control within a column, that mousedown event
fires, only several very thin parts of the grid are really triggering
grid events.

With that in mind you max be able to reproduce and debug the
behaviour.

Bye, Olaf.



Re: VFP8, Grid crashing when line item is clicked by Dan

Dan
Thu Aug 25 12:10:53 CDT 2005

I was very careful to click on the Textbox portion of the Grid / Column.
Error I get, tells me that the Grid1.mousedown is the method failing. I do
not have code in this method/event.

Just a reminder, it does not crash if I use a mouse double-click to open the
search form. It only occurs when I use the keyboard to run the procedure.

Thx again,

Dan



"Olaf Doschke" <T2xhZi5Eb3NjaGtlQFNldG1pY3MuZGU@strconv.14> wrote in message
news:eWCjjpYqFHA.3424@TK2MSFTNGP14.phx.gbl...
>
> > Has anyone seen a problem VFP crashing on a mousedown event of the a
grid.
> > I have no code in the mousedown event to trigger an error. When I put a
> > messagebox line in this event, it never fires.
> It fires, if you click exactly on the grid lines (and/or grid border),
> as those are the very thin parts of the grid being itself.
>
> If you click on a control within a column, that mousedown event
> fires, only several very thin parts of the grid are really triggering
> grid events.
>
> With that in mind you max be able to reproduce and debug the
> behaviour.
>
> Bye, Olaf.
>
>



Re: VFP8, Grid crashing when line item is clicked by Olaf

Olaf
Thu Aug 25 12:19:59 CDT 2005

>I was very careful to click on the Textbox portion of the Grid / Column.
> Error I get, tells me that the Grid1.mousedown is the method failing. I do
> not have code in this method/event.
>
> Just a reminder, it does not crash if I use a mouse double-click to open the
> search form. It only occurs when I use the keyboard to run the procedure.
The subject tells us, that an error occurs, when clicking
on the grid lines...

I haven't read it thoroughly then. If an error occurs from keypress
I'm puzzled.

Do you/ does the grid make use of Bindevents()? Is this the basic grid
class or a derived class?

Bye, Olaf.



Re: VFP8, Grid crashing when line item is clicked by trw7at

trw7at
Thu Aug 25 13:08:16 CDT 2005

Dan Tallent seemed to utter in
news:OlJpOjYqFHA.3352@TK2MSFTNGP14.phx.gbl:

> I have a grid that sits on the form. One of the columns is for Part
> Number.
> This grid is used for (data entry)
>
> I have a seperate table that list the all known part numbers. I have a
> search form that list the part numbers of this other table. This
> search form has a grid of its own.
>
> This setup allows the user to simply enter a known part number, double
> click to fire the search form, or hit the question mark from the
> keyboard to fire the search form.
>
> When the user double-clicks, everything works great. The search form
> opens, the user picks one part number from the search form. It then
> fills in the row I was on with the selected value.
>
> The problem is when I use the "?" question mark to fire the search
> form. When the search form opens, it list the first 10 hits starting
> from the top of the Part Number file.
> As soon as I click the grid on the search form, the program crashes.
>
> Error # 52, Line 0, Method: Grid1.mousedown
> No table is open is the current work area.

So the error occurs in the search form when you click on that
grid, correct? There does not need to be code in this grid's
mousedown in order for an error to be raised (as you can see by
the telltale "line 0" in the error message). It looks like
the contents of the search grid are not being setup or maintained
correctly. When you give focus to the grid by clicking on it,
VFP wants to move the record pointer of the grid's controlSource
to the corresponding record. If the controlSource cursor/table
has been closed or is inaccessible in the form's dataEnvironment,
you will get such an error.

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________

Re: VFP8, Grid crashing when line item is clicked by Dan

Dan
Thu Aug 25 15:10:05 CDT 2005

That was my first thought. A temporary cursor is being created using
CREATE CURSOR and the the recordsource is setup during the init. It is not
destroyed until the Destroy event of the Grid.

The cursor name is unique to my search form. I am only using 1 search form
during my testing.

clTempFileSS = revnum + "SS"
RecordSourceType = 1 && Alias
Recordsource = clTempFileSS

Remember, the routine called from the DblClick is exactly the routine called
from the KeyPress. When coming from a KeyPress is always crashes. The
dblclick works good.


Thx,
Dan






"Tim Witort" <trw7at@ixdot.netcomdotcom> wrote in message
news:Xns96BD7158B8E9Ctimwitortwrotethis@207.217.125.201...
> Dan Tallent seemed to utter in
> news:OlJpOjYqFHA.3352@TK2MSFTNGP14.phx.gbl:
>
> > I have a grid that sits on the form. One of the columns is for Part
> > Number.
> > This grid is used for (data entry)
> >
> > I have a seperate table that list the all known part numbers. I have a
> > search form that list the part numbers of this other table. This
> > search form has a grid of its own.
> >
> > This setup allows the user to simply enter a known part number, double
> > click to fire the search form, or hit the question mark from the
> > keyboard to fire the search form.
> >
> > When the user double-clicks, everything works great. The search form
> > opens, the user picks one part number from the search form. It then
> > fills in the row I was on with the selected value.
> >
> > The problem is when I use the "?" question mark to fire the search
> > form. When the search form opens, it list the first 10 hits starting
> > from the top of the Part Number file.
> > As soon as I click the grid on the search form, the program crashes.
> >
> > Error # 52, Line 0, Method: Grid1.mousedown
> > No table is open is the current work area.
>
> So the error occurs in the search form when you click on that
> grid, correct? There does not need to be code in this grid's
> mousedown in order for an error to be raised (as you can see by
> the telltale "line 0" in the error message). It looks like
> the contents of the search grid are not being setup or maintained
> correctly. When you give focus to the grid by clicking on it,
> VFP wants to move the record pointer of the grid's controlSource
> to the corresponding record. If the controlSource cursor/table
> has been closed or is inaccessible in the form's dataEnvironment,
> you will get such an error.
>
> -- TRW
> _______________________________________
> t r w 7
> at
> i x dot n e t c o m dot c o m
> _______________________________________



Re: VFP8, Grid crashing when line item is clicked by Dan

Dan
Thu Aug 25 15:12:11 CDT 2005

I don't use Bindevents anywhere in this project. It is build from the
derived class, but it does not have any code associated with derived class.

Thx,
Dan


"Olaf Doschke" <T2xhZi5Eb3NjaGtlQFNldG1pY3MuZGU@strconv.14> wrote in message
news:eOskKpZqFHA.156@TK2MSFTNGP11.phx.gbl...
> >I was very careful to click on the Textbox portion of the Grid / Column.
> > Error I get, tells me that the Grid1.mousedown is the method failing.
I do
> > not have code in this method/event.
> >
> > Just a reminder, it does not crash if I use a mouse double-click to open
the
> > search form. It only occurs when I use the keyboard to run the
procedure.
> The subject tells us, that an error occurs, when clicking
> on the grid lines...
>
> I haven't read it thoroughly then. If an error occurs from keypress
> I'm puzzled.
>
> Do you/ does the grid make use of Bindevents()? Is this the basic grid
> class or a derived class?
>
> Bye, Olaf.
>
>



Re: VFP8, Grid crashing when line item is clicked by Dan

Dan
Thu Aug 25 15:19:55 CDT 2005

Another thought,

you are correct ... it errors on the search form.

I put code into the Error event on the search form. This is how I trapped
the message and line number.

* Error Event
LPARAMETERS nError, cMethod, nLine

MESSAGEBOX("Error M:"+cMethod+" E:" + ALLTRIM(STR(nError)) + " L:" +
ALLTRIM(STR(nLine)))

local clTempfileSS
clTempFileSS= revnum+'SS'

MESSAGEBOX("TempFile: " + clTempFileSS + IIF(USED(clTempFileSS)=.t.,"Is
Currently in use","Is not available"))



*
It reported "Currently in use"

So the table is not closing...

Any other ideas?

Thx

Dan







"Tim Witort" <trw7at@ixdot.netcomdotcom> wrote in message
news:Xns96BD7158B8E9Ctimwitortwrotethis@207.217.125.201...
> Dan Tallent seemed to utter in
> news:OlJpOjYqFHA.3352@TK2MSFTNGP14.phx.gbl:
>
> > I have a grid that sits on the form. One of the columns is for Part
> > Number.
> > This grid is used for (data entry)
> >
> > I have a seperate table that list the all known part numbers. I have a
> > search form that list the part numbers of this other table. This
> > search form has a grid of its own.
> >
> > This setup allows the user to simply enter a known part number, double
> > click to fire the search form, or hit the question mark from the
> > keyboard to fire the search form.
> >
> > When the user double-clicks, everything works great. The search form
> > opens, the user picks one part number from the search form. It then
> > fills in the row I was on with the selected value.
> >
> > The problem is when I use the "?" question mark to fire the search
> > form. When the search form opens, it list the first 10 hits starting
> > from the top of the Part Number file.
> > As soon as I click the grid on the search form, the program crashes.
> >
> > Error # 52, Line 0, Method: Grid1.mousedown
> > No table is open is the current work area.
>
> So the error occurs in the search form when you click on that
> grid, correct? There does not need to be code in this grid's
> mousedown in order for an error to be raised (as you can see by
> the telltale "line 0" in the error message). It looks like
> the contents of the search grid are not being setup or maintained
> correctly. When you give focus to the grid by clicking on it,
> VFP wants to move the record pointer of the grid's controlSource
> to the corresponding record. If the controlSource cursor/table
> has been closed or is inaccessible in the form's dataEnvironment,
> you will get such an error.
>
> -- TRW
> _______________________________________
> t r w 7
> at
> i x dot n e t c o m dot c o m
> _______________________________________



Re: VFP8, Grid crashing when line item is clicked by Allan

Allan
Mon Aug 29 00:51:52 CDT 2005

Hi Dan,

This must have something to do with the DataSession property of your form.
Try to set the property to 2 - Private Data Session on both forms and drap a
copy the table on both DataEnvironment of the forms. Save the primary key on
the search form when it closes by using the return value during UnLoad, the
use that to Seek the value in the calling form to do the necessary updating...

Just a thought, hope this will help...

Allan

"Dan Tallent" wrote:

> Another thought,
>
> you are correct ... it errors on the search form.
>
> I put code into the Error event on the search form. This is how I trapped
> the message and line number.
>
> * Error Event
> LPARAMETERS nError, cMethod, nLine
>
> MESSAGEBOX("Error M:"+cMethod+" E:" + ALLTRIM(STR(nError)) + " L:" +
> ALLTRIM(STR(nLine)))
>
> local clTempfileSS
> clTempFileSS= revnum+'SS'
>
> MESSAGEBOX("TempFile: " + clTempFileSS + IIF(USED(clTempFileSS)=.t.,"Is
> Currently in use","Is not available"))
>
>
>
> *
> It reported "Currently in use"
>
> So the table is not closing...
>
> Any other ideas?
>
> Thx
>
> Dan
>
>
>
>
>
>
>
> "Tim Witort" <trw7at@ixdot.netcomdotcom> wrote in message
> news:Xns96BD7158B8E9Ctimwitortwrotethis@207.217.125.201...
> > Dan Tallent seemed to utter in
> > news:OlJpOjYqFHA.3352@TK2MSFTNGP14.phx.gbl:
> >
> > > I have a grid that sits on the form. One of the columns is for Part
> > > Number.
> > > This grid is used for (data entry)
> > >
> > > I have a seperate table that list the all known part numbers. I have a
> > > search form that list the part numbers of this other table. This
> > > search form has a grid of its own.
> > >
> > > This setup allows the user to simply enter a known part number, double
> > > click to fire the search form, or hit the question mark from the
> > > keyboard to fire the search form.
> > >
> > > When the user double-clicks, everything works great. The search form
> > > opens, the user picks one part number from the search form. It then
> > > fills in the row I was on with the selected value.
> > >
> > > The problem is when I use the "?" question mark to fire the search
> > > form. When the search form opens, it list the first 10 hits starting
> > > from the top of the Part Number file.
> > > As soon as I click the grid on the search form, the program crashes.
> > >
> > > Error # 52, Line 0, Method: Grid1.mousedown
> > > No table is open is the current work area.
> >
> > So the error occurs in the search form when you click on that
> > grid, correct? There does not need to be code in this grid's
> > mousedown in order for an error to be raised (as you can see by
> > the telltale "line 0" in the error message). It looks like
> > the contents of the search grid are not being setup or maintained
> > correctly. When you give focus to the grid by clicking on it,
> > VFP wants to move the record pointer of the grid's controlSource
> > to the corresponding record. If the controlSource cursor/table
> > has been closed or is inaccessible in the form's dataEnvironment,
> > you will get such an error.
> >
> > -- TRW
> > _______________________________________
> > t r w 7
> > at
> > i x dot n e t c o m dot c o m
> > _______________________________________
>
>
>

Re: VFP8, Grid crashing when line item is clicked by Dan

Dan
Mon Aug 29 11:19:46 CDT 2005

The two forms are the only two in use. I start the program up, click a
button from a menu and the Data Entry form opens. The data entry form does
not share any common database with the search form. The search form simply
returns the value of the selected item.
I could see the problem with having a shared database across two forms.
This is not the problem in this case. I like your thinking... its
something off the wall causing this.. I don't know..

I was able to add code to the Error event that traps for Cursor/Table not
available. If the error occurs the Search form is closed automatically.
This is not a solution, but it does prevent the user from freezing up from
my untrapped error.

Any other ideas??

Thx again,
Dan



"Allan" <Allan@discussions.microsoft.com> wrote in message
news:E4CFF052-E797-4EC0-A943-BCD6BB40EA2E@microsoft.com...
> Hi Dan,
>
> This must have something to do with the DataSession property of your form.
> Try to set the property to 2 - Private Data Session on both forms and
drap a
> copy the table on both DataEnvironment of the forms. Save the primary key
on
> the search form when it closes by using the return value during UnLoad,
the
> use that to Seek the value in the calling form to do the necessary
updating...
>
> Just a thought, hope this will help...
>
> Allan
>
> "Dan Tallent" wrote:
>
> > Another thought,
> >
> > you are correct ... it errors on the search form.
> >
> > I put code into the Error event on the search form. This is how I
trapped
> > the message and line number.
> >
> > * Error Event
> > LPARAMETERS nError, cMethod, nLine
> >
> > MESSAGEBOX("Error M:"+cMethod+" E:" + ALLTRIM(STR(nError)) + " L:" +
> > ALLTRIM(STR(nLine)))
> >
> > local clTempfileSS
> > clTempFileSS= revnum+'SS'
> >
> > MESSAGEBOX("TempFile: " + clTempFileSS + IIF(USED(clTempFileSS)=.t.,"Is
> > Currently in use","Is not available"))
> >
> >
> >
> > *
> > It reported "Currently in use"
> >
> > So the table is not closing...
> >
> > Any other ideas?
> >
> > Thx
> >
> > Dan
> >
> >
> >
> >
> >
> >
> >
> > "Tim Witort" <trw7at@ixdot.netcomdotcom> wrote in message
> > news:Xns96BD7158B8E9Ctimwitortwrotethis@207.217.125.201...
> > > Dan Tallent seemed to utter in
> > > news:OlJpOjYqFHA.3352@TK2MSFTNGP14.phx.gbl:
> > >
> > > > I have a grid that sits on the form. One of the columns is for
Part
> > > > Number.
> > > > This grid is used for (data entry)
> > > >
> > > > I have a seperate table that list the all known part numbers. I
have a
> > > > search form that list the part numbers of this other table. This
> > > > search form has a grid of its own.
> > > >
> > > > This setup allows the user to simply enter a known part number,
double
> > > > click to fire the search form, or hit the question mark from the
> > > > keyboard to fire the search form.
> > > >
> > > > When the user double-clicks, everything works great. The search
form
> > > > opens, the user picks one part number from the search form. It then
> > > > fills in the row I was on with the selected value.
> > > >
> > > > The problem is when I use the "?" question mark to fire the search
> > > > form. When the search form opens, it list the first 10 hits starting
> > > > from the top of the Part Number file.
> > > > As soon as I click the grid on the search form, the program crashes.
> > > >
> > > > Error # 52, Line 0, Method: Grid1.mousedown
> > > > No table is open is the current work area.
> > >
> > > So the error occurs in the search form when you click on that
> > > grid, correct? There does not need to be code in this grid's
> > > mousedown in order for an error to be raised (as you can see by
> > > the telltale "line 0" in the error message). It looks like
> > > the contents of the search grid are not being setup or maintained
> > > correctly. When you give focus to the grid by clicking on it,
> > > VFP wants to move the record pointer of the grid's controlSource
> > > to the corresponding record. If the controlSource cursor/table
> > > has been closed or is inaccessible in the form's dataEnvironment,
> > > you will get such an error.
> > >
> > > -- TRW
> > > _______________________________________
> > > t r w 7
> > > at
> > > i x dot n e t c o m dot c o m
> > > _______________________________________
> >
> >
> >



Re: VFP8, Grid crashing when line item is clicked by trw7at

trw7at
Tue Aug 30 11:14:44 CDT 2005

Dan Tallent seemed to utter in
news:eYdGJCbqFHA.3540@TK2MSFTNGP14.phx.gbl:

> Remember, the routine called from the DblClick is exactly the routine
> called from the KeyPress. When coming from a KeyPress is always
> crashes. The dblclick works good.

Do you remove the keypress from the buffer in your KeyPress method?
It could be that the search form is seeing this keypress and is
not responding correctly. Obviously, something in the environment
is different between the two paths your code takes to open the
search form. These things may be the keyboard buffer, the position
of record pointers, currently open cursors, pending changes to
buffered or unbuffered tables, all of the SET() settings, etc.

A quick way to get a pretty thorough dump of this is to issue a
LIST MEMORY and LIST STATUS in your search form. List them to
a file. Do this to separate files for a KeyPress and a DoubleClick.
Then compare the files and see if there is something that is
different.

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________