Sign in to follow this  
Followers 0

Maintaining selected text when switching tabs?

6 posts in this topic

Posted

Hello, all--

 

When switching tabs, any text that had been selected in the original tab is no longer selected in the second tab.

 

original tab:

post-63807-0-84118800-1379445239_thumb.p

subsequent tab:

post-63807-0-17667000-1379445282_thumb.p

An OnTabSwitch trigger, calling this simple script, didn't solve the problem; it seems like the conclusion of the script causes a jump back to tab1:

post-63807-0-55807000-1379445337_thumb.p

 

Any suggestions appreciated. Thanks very much!

 

 

0

Share this post


Link to post
Share on other sites

Posted

This happens whenever you have multiple instances of a field on a layout and you put the focus on the field, e.g. with Go to Field. In this case, setting the selection puts the focus on the field. I believe it is the object stacking order that determines which instance "wins."

 

To control this, give each instance of the field an object name, and after the tab switch, have it go to the object on that tab. Then, when you set the selection, leave the target field option blank, i.e. don't specify a field.

Set Variable( $selectedStart ; Get ( ActiveSelectionStart ) )
Set Variable( $selectedSize ; Get ( ActiveSelectionSize ) )
Go to Object( "tabField2" )
Set Selection( Start: $selectedStart ; End: $selectedStart + $selectedSize - 1 )
0

Share this post


Link to post
Share on other sites

Posted

Try naming the field object itself. Something like:

 

Go to Object [field2]

Set Selection [start Position: 1; End Position: 21 ]

 

 

Dont set a field as a target

 

 

Edit: Looks like tom got you in the right direction... :-)  The selection start and size may have to be stored in a couple of global variables with an onObjectExit on the field though.

0

Share this post


Link to post
Share on other sites

Posted

Ah you're right, not specifying the field did the trick.  But now here's something weird that I wasn't expecting...

 

If you click the 'go to tab 2' button in my attached sample file, the text is selected as desired but it's EDITABLE!  The field in tab 2 is actually defined to disallow data entry in browse mode, but I am still able to add or delete text until I commit the record.  Does this have something to do with the object stacking order or some other layout behavior?  Is there any way around this, because I can't allow my users to edit text in the 2nd tab.

 

Thanks very much for your time!

fmf.fmp12.zip

0

Share this post


Link to post
Share on other sites

Posted

Well if you have the text selected then it is editable. You can always go the old fashioned method and use a calculation field for your second tab. Then they cant edit it at all.

0

Share this post


Link to post
Share on other sites

Posted

Well if you have the text selected then it is editable. You can always go the old fashioned method and use a calculation field for your second tab. Then they cant edit it at all.

Yes that's another good idea, a calc field would be un-editable no matter what.  Many thanks to you both.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0