Discussion:
Up / Down Arrows
(too old to reply)
Ken Mayer [dBVIPS]
2008-10-17 21:33:14 UTC
Permalink
Using a seeker control or any other entryfield, is there any way that I can
detect if the up/down arrow keys were pressed?
Hmm. The key() event doesn't trap the arrow keys ... neither does
onKey() ...

Not sure you can check for those.

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Rich - AutoTraker Inc.
2008-10-17 22:04:14 UTC
Permalink
ON KEY LABEL Uparrow [<command>]
ON KEY LABEL Dnarrow [<command>]

Works for me...
Just don't forget ON KEY LABEL is global so set them on the onGotFocus and
disable them onLostFocus
Rich...
Using a seeker control or any other entryfield, is there any way that I
can detect if the up/down arrow keys were pressed?
Hmm. The key() event doesn't trap the arrow keys ... neither does onKey()
...
Not sure you can check for those.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
John Noble
2008-10-17 22:43:23 UTC
Permalink
Hello Guys,

I'm using a Seeker Control along with a grid. The grids height shows around
10 rows. It also has 2 columns - ID & Name.
As the user types the beginning of the ID into the seeker, the grid will
begin to find the first closest match. What I would like the up / down
arrows to do is move the selected row on the grid.

So I want:
UpArrow = form.rowset.next(-1)
DnArrow = form.rowset.next()

Sorry if this is a dumb question but where and how do I do this?
Post by Rich - AutoTraker Inc.
ON KEY LABEL Uparrow [<command>]
ON KEY LABEL Dnarrow [<command>]
Works for me...
Just don't forget ON KEY LABEL is global so set them on the onGotFocus and
disable them onLostFocus
Rich...
Using a seeker control or any other entryfield, is there any way that I
can detect if the up/down arrow keys were pressed?
Hmm. The key() event doesn't trap the arrow keys ... neither does onKey()
...
Not sure you can check for those.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Bruce Beacham
2008-10-18 19:11:27 UTC
Permalink
Post by John Noble
I'm using a Seeker Control along with a grid. The grids height shows around
10 rows. It also has 2 columns - ID & Name.
As the user types the beginning of the ID into the seeker, the grid will
begin to find the first closest match. What I would like the up / down
arrows to do is move the selected row on the grid.
The user needs to press Tab, and they are in the grid and can use the
arrow keys, etc.

BUT you don't want them to press Enter to select their choice BECAUSE a
weakness in dBASE is that, on pressing Enter to submit a form (see
CUAENTER) when the user is in a grid, you get two actions:
1 the cursor moves to the next row on the grid, and
3 the form closes, with the NEXT row cnsequently being the apparent
selection.

It's a PITA.

I've wished for the ENTER movement to be switchable, no joy in the last
nine years on that, so I'll just dream on.


Bruce Beacham
Rich Assaf
2008-10-19 19:41:20 UTC
Permalink
Post by John Noble
Hello Guys,
I'm using a Seeker Control along with a grid. The grids height shows around
10 rows. It also has 2 columns - ID & Name.
As the user types the beginning of the ID into the seeker, the grid will
begin to find the first closest match. What I would like the up / down
arrows to do is move the selected row on the grid.
UpArrow = form.rowset.next(-1)
DnArrow = form.rowset.next()
Sorry if this is a dumb question but where and how do I do this?
John,

If all you want to do is add arrow key navigation to a seeker control,
Marc VdB created an mSeeker.cc control (which I extended slightly with a
few other options). I've been using it successfully, and it's replacing
the ON KEY LABEL option I posted in an earlier message, primarily
because the ON KEY LABEL is slightly but noticeably slower than mSeeker.

Header below, zip posted in Binaries:


/***********************************************************************

Programmers....: Marc Van den Berghen, Roland Wingerter, Rich Assaf

Version........: 0.6 (5 May 2008)

Notes..........: This seeker extends basic Seeker/zSeeker functionality

Additional features:
- Up/Down arrow keys can be used to navigate in the rowset
- PgUp and PgDn will skip by user-defined nSkipRecords
- Home and End keys go first() and last() respectively
- PgUp/PgDn/Home/End can be ignored by the paintbox
- seeker can optionally react to the Enter key
(just assign your own method).
- optionally execute code if seeker doesn't find a match
- Features from zSeeker (By Peter Rorlick, Feb 1998)
* Does a SEEK on Backspace or Del
* Yellow background when in focus.
* Choice to enable/disable the exact match functionality

Written for ...: dBase 32bit (7.0 --> )

History.......:
0.1 (Jan 12, 2007) Marc VdB posted Seekerform.wfm in dbase.programming
0.2 (Jan 12, 2007) R. Wingerter made cc form Marc's code
0.3 (Jan 13, 2007) New custom property onEnterAction replaces
properties bSelectOnEnter and cFieldName.
0.5 (Feb 24, 2007) - Rich Assaf
Extended paintbox to respond to Home/End/PgUp/PgDn.
Eliminated dependencies on zSeeker and Seeker
Added NoMatch functionality if the seek fails
Corrected typo: re_estate() to re_state()
0.6 (May 5, 2008) - Rich Assaf
Added properties lAllowEOF and lSelectAll
Reason:
If true, lAllowEOF will position record pointer to EOF,
visually indicating (to datalinked controls) if the
seeker is in uncharted territory.... lSelectAll more
robustly selects the entire field contents than the built-
in standard EntryField property (allows single mouse click).

Dependencies.: Messenger.cc (included at bottom of this file)

Usage.......: This class can be used in the same way as Seeker.cc.
In the form designer, make sure that the rowset you wish
to use this control with has the indexName property set to
an index tag that is character, and created with the UPPER()
function, so that it is indexed on the upper-case of any
characters in the field(s) index on.

Drag the SEEKER control to the design surface. When the form
is run, entering text in the entryfield will cause an
incremental search to occur, using the index tag mentioned
above.
NOTE: do not attempt to datalink this custom entryfield,
first, it is "protected" so that you cannot access this
property in the designer, and second, the code will not function
properly if datalinked to a field in the table.

If you want the control to react to the Enter key,
simply assign a method to this.onEnterAction in
an overridden onOpen event. (cf. sample form).

Note that, although not required, it is a good idea to call
mSeeker.cleanup() in your form's canClose event.

***********************************************************************/
Rich Assaf
2008-10-18 00:38:34 UTC
Permalink
Using a seeker control or any other entryfield, is there any way that I can
detect if the up/down arrow keys were pressed?
John,

You can use a work-around, something like this:
(Note: the form's onGotFocus requires {;_app.CurrentForm = form} )
( caution: creates a circular reference, stub out in canClose() )

function SEEKER1_onGotFocus
ON KEY LABEL DnArrow _app.CurrentForm.Skip(1)
ON KEY LABEL UpArrow _app.CurrentForm.Skip(-1)
MYSEEKER::ONGOTFOCUS()
return

function SEEKER1_onLostFocus
ON KEY
MYSEEKER::ONLOSTFOCUS()
return

function Skip( nRec )
form.rowset.next(nRec)
if form.rowset.endofSet
BEEP // and move back
form.rowset.next(-nRec)
endif

hth, Rich
Ken Mayer [dBVIPS]
2008-10-18 14:35:28 UTC
Permalink
Post by Rich Assaf
(Note: the form's onGotFocus requires {;_app.CurrentForm = form} )
( caution: creates a circular reference, stub out in canClose() )
D'oh -- forgot about that. I have done this kind of thing for a client
(but for different keys) ... good catch.

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Greg Hill
2008-10-18 02:07:11 UTC
Permalink
From: "Marc VdB" <***@web.de>
Subject: Seeker with up and down arrows
Date: Fri, 12 Jan 2007 18:46:21 +0100

Greg Hill
Greg Hill
2008-10-18 02:04:57 UTC
Permalink
Using a seeker control or any other entryfield, is there any way that I
can detect if the up/down arrow keys were pressed?
Marc VDB donated such a control to do what you are asking. At least what I
think your asking.

As you are typing the field you can press down arrow to scroll the grid
without leaving the field, it is very elegant and solid.

I use it in my apps.

Thank you Marc....

Look in the binaries for it under MARCSEEKER.CC

Greg Hill
Geoff Wass [dBVIPS]
2008-10-18 05:34:22 UTC
Permalink
Post by Greg Hill
Marc VDB donated such a control to do what you are asking. At least what I
think your asking.
As you are typing the field you can press down arrow to scroll the grid
without leaving the field, it is very elegant and solid.
I use it in my apps.
Thank you Marc....
Look in the binaries for it under MARCSEEKER.CC
Greg Hill
Greg,

Yes! That's the one I was trying to remember! :-)
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Marc VdB
2008-10-18 09:47:38 UTC
Permalink
Post by Greg Hill
Marc VDB donated such a control to do what you are asking. At least what I
think your asking.
I use it in my apps.
Thank you Marc....
My pleasure!

CU, Marc
Bruce Beacham
2008-10-18 19:12:58 UTC
Permalink
Post by Greg Hill
As you are typing the field you can press down arrow to scroll the grid
without leaving the field, it is very elegant and solid.
Look in the binaries for it under MARCSEEKER.CC
Might be a solution for me too. Thanks.


Bruce Beacham
Loading...