Normal Topic Navigation in Subform (Read 937 times)
CapitalG
Full Member
Members
***
Offline



Posts: 143
Location: Phoenix, Arizona
Joined: Mar 4th, 2003
Navigation in Subform
Feb 19th, 2011 at 11:38pm
Print Post Print Post  
I need pointed in the right direction regarding navigation on a subform.  I have a subform that has 7 fields on it.  The first three fields are entered by hand.  The other 4 fields are filled with programming based on what is entered in the first 3 fields.  This subform is displayed in table mode.  The data entry is slowed down because after the 3rd field is entered, the natural navigation drops you into the 4th field of that record.  
How would I go about changing this to let them enter fields 1,2,3 on record 1 and then to fields 1,2,3 on record 2 and so on?  Right now they have to mouse click on the next record.   Any direction is appreciated.
Thank you
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Navigation in Subform
Reply #1 - Feb 21st, 2011 at 12:50am
Print Post Print Post  
Can't they just press the down arrow? If they are adding new subrecords, the cursor should begin in the 1st field when you move down to a new row.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Navigation in Subform
Reply #2 - Feb 21st, 2011 at 2:11am
Print Post Print Post  
CapitalG,

I have a similar situation/need (table form, and pressing the <enter> key after the last 'user input' field results in the cursor jumping to the first field in the next line down).  My life is easier if my users can use the enter or tab key, rather than the arrow down key (I decided I'd rather switch than fight), so here's the solution that worked for me:

Once I input data into Field A (TLItemNum) and press <enter>, the cursor enters Field B (TLItemDesc), whereupon OnElementEntry programming jumps the cursor down and into the first field on the next line down in the table form.

FieldB (TLItemDesc)::OnElementEntry

var n as int

If @Mode() < 2
{
n = @SelectTreeItem("Add Data Menu!Navigation!Advance Record (F10)")
throwfocus(TLItemNum)
}
  

Larry
Back to top
IP Logged
 
CapitalG
Full Member
Members
***
Offline



Posts: 143
Location: Phoenix, Arizona
Joined: Mar 4th, 2003
Re: Navigation in Subform
Reply #3 - Feb 21st, 2011 at 2:56pm
Print Post Print Post  
Thank you for the information.  I neglected to tell you that all the records in the table(subform) are created up front.  These are pickup/delivery routes and the routes are prepopulated into the table.  The data entry person is filling in 3 fields with the weight of items collected at each stop.  The down arrow key just moves them to the third field of the next record.  This is what they are doing now - down arrow, left arrow, left arrow.  They don't like it and I don't blame them.
Can this be done programatically?  I played around with Throwfocus and did not make any progress.

Thanks
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Navigation in Subform
Reply #4 - Feb 21st, 2011 at 10:56pm
Print Post Print Post  
Assuming you are using the latest version (2.5.2), because table-view subforms worked a bit differently prior to version 2.5.0, you should be able to achieve what you are asking by using the following code in the On Element Entry event of the 4th field. This is very close to what lksseven posted, except that his code won't work in search/update mode.

Code
Select All
var Success as int


If @Mode() = 0		// Add
	Success = @SelectTreeItem("Add Data Menu!Navigation!Advance Record (F10)")
Else If @Mode() = 1	// Update
	Success = @SelectTreeItem("Search Update Menu!Navigation!Advance Record (F10)")

ThrowFocus(TDate) // Adjust the name here to fit your application
 



Every time the user tabs into the 4th field, focus will automatically go the the 1st field on the next row. The only issue with this is that when they finish with the last subrecord, the focus will move to a new blank subrecord. Not a real problem, because it will not be saved/added unless they type something in one of the fields or if programming populates one of the fields. But still, it may not be what you want. If you want to prevent this, you can add the code below to the On Form Entry event.

With the code below, the cursor will jump to the 1st row in the subform after the tabbing into the 4th field in the last subrecord, rather than going to a new blank subrecord. (Hope I explained that clearly enough.)

Code
Select All
// Prevent Extend Mode
FormNotifyForm(@Layout + ":(Update)", 7)
 

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
CapitalG
Full Member
Members
***
Offline



Posts: 143
Location: Phoenix, Arizona
Joined: Mar 4th, 2003
Re: Navigation in Subform
Reply #5 - Feb 22nd, 2011 at 1:43am
Print Post Print Post  
Thank you.  That is exactly what I needed.   Smiley
  
Back to top
 
IP Logged