At 12:22 PM 1/27/2009, "Diane DeMers" <[email protected]> wrote:
Does anyone know of a way to force the focus to the first row and
column of a dbGrid?
Diane,
Use "PROPERTY TABLE DBGridTableName JUMPTO 1" to switch the row
position to the first row. Then use the SELECTEDINDEX '0' which
will set the focus to the first column of the DB Grid as well.
Here's how:
01. Create a quick form based on "RRBYW14" and use "Customer"
table for the DB Grid Control.
Assign a Component ID to DB Grid controls, such as:
DBGrid_Customer
02. Now place a "Speed Button" or "Bit Button" with the following
properties:
Caption: Jump to First Row/Column
Custom EEP:
-- start
PROPERTY TABLE Customer 'JUMPTO 1'
PROPERTY DBGrid_Customer SET_FOCUS 'TRUE'
PROPERTY DBGrid_Customer SELECTEDINDEX '0'
RETURN
-- end
Notice the 'JUMPTO 1' enclosed in quotes.
JUMPTO 1 will switch the current record to 1.
SET_FOCUS 'TRUE' will force the focus to Customer table in case
the user was working on a different table in a multi-table form.
SELECTEDINDEX '0' will select the First Column associated with
the DB Grid Control.
That should demonstrate the functionality of DB Grid Properties and how to
switch the focus to first row and the first column.
For more details on DB Grid PROPERTY and GETPROPERTY commands, take a look
at the "All About DB Grid", among the sample applications included with 2009
SAT (2009 Super Advanced Training).
For your viewing pleasure:
http://www.rbaseuniversity.com/2009_sat_sampleapps/All_About_DBGrid_01.png
http://www.rbaseuniversity.com/2009_sat_sampleapps/All_About_DBGrid_02.png
http://www.rbaseuniversity.com/2009_sat_sampleapps/DBGrid_Properties_II.png
Very Best R:egards,
Razzak.