Normal Topic Throwfocus help (Read 1057 times)
CapitalG
Full Member
Members
***
Offline



Posts: 143
Location: Phoenix, Arizona
Joined: Mar 4th, 2003
Throwfocus help
Jun 29th, 2011 at 3:43pm
Print Post Print Post  
I have a subform that has the following 5 elements in table view: Location, Soft, Trash, Hard, ActSoft.  I have the following code in the On Element Entry event of the ActSoft element.  


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(Location) // Throws Focus to the Location on the newly created Record in the subform


 



After the user enters data into the first 4 elements and the focus goes to the ActSoft element, the Advance Record triggers and inserts the next record (assuming it is in Add or Update mode) and then the focus is placed in the first element (Location) of that new record.  

The issue I am having is that when the records reach the bottom of the visible subform, the next record is placed in the subform BUT, the focus goes back to the top - the first line of the subform.  Is there a way to get it to "scroll" on down?

Thanks in advance for your help.

Greg
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Throwfocus help
Reply #1 - Jun 29th, 2011 at 7:36pm
Print Post Print Post  
I can't test this right now, but you might try FormResultSetCurrentPosition. I usually create unbound elements on the parent form with an Add button to validate and then create the subrecord, so this doesn't come up for me.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
CapitalG
Full Member
Members
***
Offline



Posts: 143
Location: Phoenix, Arizona
Joined: Mar 4th, 2003
Re: Throwfocus help
Reply #2 - Jun 30th, 2011 at 8:30pm
Print Post Print Post  
Thank you.  I will look at this over the weekend.  Smiley
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Throwfocus help
Reply #3 - Jul 1st, 2011 at 9:06pm
Print Post Print Post  
Hammer wrote on Jun 29th, 2011 at 7:36pm:
...I usually create unbound elements on the parent form with an Add button to validate and then create the subrecord, so this doesn't come up for me.


I absolutely agree, and encourage everyone to go with this method, if possible.

After many years of resisting this approach, I finally converted all of my applications over to using this method of entering data into subforms, about 1-1/2 years ago. It has proved to be the easiest and most reliable way to deal with table-view subforms.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged