PDA

View Full Version : Focus in dbGrid



Joe Coley
8-Feb-2005, 09:08 AM
Using VDF 10.1 Native DF, I have a dbGrid which is displaying data using a
date index in reverse order (most recent to oldest/blank date). The grid
data is constrained by a header record. I want to ensure that when data is
displayed the focus is ALWAYS on the grid record that has the most recent
date. For some reason, it appears that this does not always happen. The
index being called out is the related field of the header, the date, recnum.
Isn't there some command that I can add to the table which will force focus
to the first record of the index?

Garret Mott
8-Feb-2005, 09:32 AM
Joe -

Not sure you want to add it to the Grid, but wherever you are finding the
header record, after the find is done, Send Beginning_of_Data to the grid.

That should set it on the first row.

HTH

Garret


"Joe Coley" <sjoec@charter.net> wrote in message
news:ANg61eeDFHA.1912@dacmail.dataaccess.com...
> Using VDF 10.1 Native DF, I have a dbGrid which is displaying data using a
> date index in reverse order (most recent to oldest/blank date). The grid
> data is constrained by a header record. I want to ensure that when data
> is
> displayed the focus is ALWAYS on the grid record that has the most recent
> date. For some reason, it appears that this does not always happen. The
> index being called out is the related field of the header, the date,
> recnum.
> Isn't there some command that I can add to the table which will force
> focus
> to the first record of the index?
>
>

David Martinko
8-Feb-2005, 09:40 AM
Joe,

1) Is the indexed date field being used marked as a descending index, or
are you using the property of the dbgrid that allows for reversing the sort
order of the dbgrid?

2) Are you seeing this thru navigation of the parent file, using a
selectionlist, and/or applying manual constraints via a button?

3) One of those odd-ball and something hard-to-catch things... do you
have code in an OnChange, or New_Current_Record or some other procedure in
which you manually loop through the child file. This can have an effect as
to which record is displayed.

--
David Martinko
Redeemed Software
248-535-7495
RedeemedSoftware(SHIFT+2)Hotmail(PERIOD)com


"Joe Coley" <sjoec@charter.net> wrote in message
news:ANg61eeDFHA.1912@dacmail.dataaccess.com...
> Using VDF 10.1 Native DF, I have a dbGrid which is displaying data using a
> date index in reverse order (most recent to oldest/blank date). The grid
> data is constrained by a header record. I want to ensure that when data
> is
> displayed the focus is ALWAYS on the grid record that has the most recent
> date. For some reason, it appears that this does not always happen. The
> index being called out is the related field of the header, the date,
> recnum.
> Isn't there some command that I can add to the table which will force
> focus
> to the first record of the index?
>
>

Peter Donovan
8-Feb-2005, 09:48 AM
Hi Joe,
I'm assuming that finding a parent record you want to send beginning_of_data
to the dbgrid:

A
|
B = Main_DD
|
C = dbGrid File

// code for the B_DDO
// pad: this code works for the find keys
Procedure Request_Find Integer iMode Integer iFile Integer iIndex
Forward Send Request_Find iMode iFile iIndex
If (iFile = B.File_Number) Send Beginning_Of_Data Of odbGrid1
End_Procedure
// pad: this code works for the selection list:
Procedure Find_By_Recnum Integer iFile Integer iRecnum
Forward Send Find_By_Recnum iFile iRecnum
If (iFile = B.File_Number) Send Beginning_Of_Data Of odbGrid1
End_Procedure

Regards,
Peter Donovan
Sonata Software
www.sonatasoftware.us

Joe Coley
8-Feb-2005, 09:54 AM
After further investigation it seems that a "find next/find previous" (on
the header record) is what is causing the problem. I'm thinking that this
will use the index of the field from which the find is done, and display is
NOT according to the index that is being specified in the table. I'm
thinking that maybe I want to force reordering of the table according to the
table index on all finds. (My expectation is however that if a dbgrid
specifies display according to say, index 5, then under no conditions should
it display according to index 1 --- and that at this point SEEMS to be what
is happening.)

Could this be a "bug" in 10.1? What is the expected behavior?


"Garret Mott" <garret@automatesoftware.com> wrote in message
news:hUKBWseDFHA.1248@dacmail.dataaccess.com...
> Joe -
>
> Not sure you want to add it to the Grid, but wherever you are finding the
> header record, after the find is done, Send Beginning_of_Data to the grid.
>
> That should set it on the first row.
>
> HTH
>
> Garret
>
>
> "Joe Coley" <sjoec@charter.net> wrote in message
> news:ANg61eeDFHA.1912@dacmail.dataaccess.com...
> > Using VDF 10.1 Native DF, I have a dbGrid which is displaying data using
a
> > date index in reverse order (most recent to oldest/blank date). The
grid
> > data is constrained by a header record. I want to ensure that when data
> > is
> > displayed the focus is ALWAYS on the grid record that has the most
recent
> > date. For some reason, it appears that this does not always happen.
The
> > index being called out is the related field of the header, the date,
> > recnum.
> > Isn't there some command that I can add to the table which will force
> > focus
> > to the first record of the index?
> >
> >
>
>

Joe Coley
8-Feb-2005, 10:02 AM
Good morning Dave --

1) Is the indexed date field being used marked as a descending index, or
are you using the property of the dbgrid that allows for reversing the sort
order of the dbgrid? --- YES!

2) Are you seeing this thru navigation of the parent file, using a
selectionlist, and/or applying manual constraints via a button? --- thru
navigation of the parent file

3) One of those odd-ball and something hard-to-catch things... do you
have code in an OnChange, or New_Current_Record or some other procedure in
which you manually loop through the child file. This can have an effect as
to which record is displayed. --- NONE that I'm aware of, most everything
I do at this point is pretty basic -- always in the IDE.

David Martinko
8-Feb-2005, 10:13 AM
Joe,

I've not yet used the reverse sort order option of the DBGrid... but I
have used the descending index to display records in a grid. On a few
occasions I had some trouble doing so and needed to add a few extra lines of
code, but those were special circumstances (which I don't recall at the
moment). As for "Vanilla" displaying records in reverse order, it should
just work.

You mention that sometimes it works and sometimes it doesn't. It may
take some further investigation to see what is causing the problem.

--
David Martinko
Redeemed Software
248-535-7495
RedeemedSoftware(SHIFT+2)Hotmail(PERIOD)com


"Joe Coley" <sjoec@charter.net> wrote in message
news:F3lQ$8eDFHA.4924@dacmail.dataaccess.com...
> Good morning Dave --
>
> 1) Is the indexed date field being used marked as a descending index, or
> are you using the property of the dbgrid that allows for reversing the
> sort
> order of the dbgrid? --- YES!
>
> 2) Are you seeing this thru navigation of the parent file, using a
> selectionlist, and/or applying manual constraints via a button? --- thru
> navigation of the parent file
>
> 3) One of those odd-ball and something hard-to-catch things... do you
> have code in an OnChange, or New_Current_Record or some other procedure in
> which you manually loop through the child file. This can have an effect as
> to which record is displayed. --- NONE that I'm aware of, most everything
> I do at this point is pretty basic -- always in the IDE.
>
>