Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use record navigation buttons for one table only?

Status
Not open for further replies.

novice001

Programmer
Jun 7, 2002
18
US
Hello All!
I have two tables on the form and I want to use record navigation toolbar to move through the first table only, despite which table is active at the moment.
So if the cursor is on the second table and user clicks "Next" it moves to the next record in the first table.
Is there a way to do that? I probably should intercept Action event, but what Action Id should I look for? Can I put code in the Action of the form, so that not to put it in each table?
Thank you.
 
novice001,

Well, the easiest way is to:

1. Hide the default menu and toolbar

2. Create and disaply custom menus and toolbars that use the built-in graphic constants, but trigger code that directs the specific events to the specific UIObject you want to target.

For example, instead of using
Code:
action.postAction( dataNextRecord )
, you'd use
Code:
Table1.postAction( dataNextRecord )
(where Table1 is the name of the table frame (or MRO) that you want to direct the action to.

It is possible to override the built-in behavior of the default events, but it takes a little jiggery-pokery with the event model. I generally recommend against that approach unless you're really familiar with the side effects of the event model. It's far too easy to accidentally override the sequence of what I call the "recovery" events, the events that fire as a result of the original action that started the process.

Hope this helps...

-- Lance

 
Or, just put a moveto() at the start of each pushbutton method, sending the cursor back to a field in the first table before processing the rest of the built in code.

Mac :)

"Do not delve too deeply in the arts of your enemy and so become ensnared by them"

langley_mckelvy@cd4.co.harris.tx.us
 
Mac,

It's an interesting notion, but that itself would trigger more events. If the business rules are implemented in events like canDepart, canArrive, and so on (as opposed to data actions), then you may find that moveto() leads to stack overflows and other undesireable results.

In my experience, it's best to avoid involving the event model as much as possible. While there are cases where your idea can be useful, there's frequently a different way to accomplish the same results without generating addition events. For example, combining a TCursor attach() with a UIObject resync() can frequently acheive the same sort of results more quickly.

Hope this helps...

-- Lance

Just a thought....
 
Thanks for the info Lance. You're probably right, but I've never had a stack overflow problem. I do the same thing with my locate buttons. I do usually minimize the calls by testing to see if the cursor is already there before arbitrarily calling the moveto().

Mac :)

"Gurth a choth-en-America! Tôl acharn..."


langley_mckelvy@cd4.co.harris.tx.us
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top