LaRetta Posted December 1, 2014 Posted December 1, 2014 Is there any way to identify the tab order of fields on a layout? I have a layout with 100+ fields (in multiple tab controls) and I am attempting to compare two semi-identical files to see if the tab order has been changed. I can get the field names with FieldNames ( Get ( FileName ) ; Get ( LayoutName ) ) ... but tab order does not appear to be gathered anywhere, not even in DDR. I'm thinking I'll just have to eyeball it.
Wim Decorte Posted December 1, 2014 Posted December 1, 2014 If they all have names, does LayoutObjectNames return them in a structured fashion so that you can get the order that way? 1
LaRetta Posted December 1, 2014 Author Posted December 1, 2014 (edited) Hi Wim!! Good idea but they don't have object names. Even if I object-name them, they appear in LayoutObjectNames() in stacking order which isn't necessarily correct either. Maybe I could write a script which uses Go To Next Field[] (and writes the field names to multiline). I shall try that next! edited: added bold Edited December 1, 2014 by LaRetta
LaRetta Posted December 1, 2014 Author Posted December 1, 2014 This seems to work: remove this => # Manually go to first field in tab order before firing Go To Field [ ] // to remove cursor from field Go To Next Field [ ] // to take cursor to first field in tab order Set Variable [ $start; Value:Get ( ActiveFieldName ) ] Loop Exit Loop If [ Get ( ActiveFieldName ) = $start and ValueCount ( $result ) > 1 ] Set Variable [ $result; Value:List ( $result ; Get ( ActiveFieldName ) ) ] Go to Next Field End Loop Set Variable [ $$result; Value:$result ] In all my years in this business, this is the first time I've wanted/needed to compare tab order! I'll need to disable triggers first but that's already in place anyway. Edit: modified script as suggested by Comment (see red above) 2
comment Posted December 2, 2014 Posted December 2, 2014 I believe the script is the only way (if the order is not anywhere in the DDR). But you don't need to "Manually go to first field in tab order before firing". Go to Next Field[] goes to the first field in tab order if no field is selected. 2
LaRetta Posted December 2, 2014 Author Posted December 2, 2014 (edited) Well I learned another wonderful little tid-bit today! Thank you!! In fact, my mind reels ... this isn't a 'little' tid-bit at all. Much appreciated! corrected auto-spell correction :*) Oh! Go To NEXT field! I removed my excitement-misinterpretation. What a nice way to jump to the beginning of fields! I modified my script accordingly. :-) Edited December 2, 2014 by LaRetta
comment Posted December 2, 2014 Posted December 2, 2014 Something to think about: what if the first field in tab order has another instance on the same layout? I don't see a simple solution for that - the only thing comes to mind is to compare the field's bounds in addition to the field's name in the exit condition.
LaRetta Posted December 2, 2014 Author Posted December 2, 2014 OMG, I had just been thinking about possibility of duplicate records so I've been testing. - - - - - Prior to the loop, add next step. Mark the left/top position so it can be found next time around Set Variable [ $position ; LeftWords ( FieldBounds ( Get ( FileName ) ; Get ( LayoutName ) ; $start ) ; 2 ) ] - - - - - Then Exit Loop would be changed to: Exit Loop If [ Get ( ActiveFieldName ) = $start and ValueCount ( $result ) ≥ 1 and $position = LeftWords ( FieldBounds ( Get ( FileName ) ; Get ( LayoutName ) ; $start ) ; 2 ) If two identical fields were potentially stacked in same location, Michael, it could get messy for sure. Your idea will work using its bounds (as above) but I was a bit deflated when I was just bitten ... I don't walk layouts very often and I had forgotten ... Go To NEXT Field will only enter fields on the top tab panel - and just testing, same with Sliders (top panel only) and it won't jump to Popover at all - only visible (not hidden) fields. I guess by now I could have manually compared them or attached object names (even numbering them) along the lines you suggested, Wim. It's really too bad that we can't object-name by calculation. :-) FM must store the tab order somewhere. It must be attached to the object attribute somehow. In all, a great learning experience as always! Thank you both so much! Okay, LaRetta, quit playing FileaMaker and go to bed!!
Recommended Posts
This topic is 3655 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now