Possible to make conditional tab-order?

pdjpdj Member Posts: 643
I have a tabular form (a journal) with 30+ fields and a specific tab-order that jumps through 5 fields before jumping to a new line. This works fine. Now I need to add a column in the tab-order, but only if the user has made the column visible. First I simple added the column in the tab-order, but when the user doesn't show the colum it doesn't work. I have also tried setting the right control active in the OnDeactivate trigger, but that gives me a stack overflow error.

Simple example:
Type,No.(nextcontrol=Quantity),Description,Quantity(nextcontrol=No.)
Now I need to add a column between Description and Quantity, which (when visible) should be in the tab-order.

Any ideas on how to solve this, without making two forms?
Regards
Peter

Comments

  • matttraxmatttrax Member Posts: 2,309
    You can't change the NextControl property in code.

    What happens when you set the NextControl property and then tab when the next control is not visible? I've actually never tried. Does the cursor just disappear into the invisible column until you TAB again?
  • pdjpdj Member Posts: 643
    Nothing happens. It simply stays at the No. column ](*,)
    Regards
    Peter
  • matttraxmatttrax Member Posts: 2,309
    How about this.

    So you have column1 and when you tab off column1 it goes to next field...just standard.

    Add an identical column, column1_2. Same field, same everything except the control number and the NextControl property.

    In the OnActivate/Deactivate triggers for these columns and the one you show/hide you can make sure that the correct ones are visible. The only drawback I see is that for a moment you could have coumn1 and column1_2 both visible at the same time (until you activate and deactivate one of the fields).
  • David_SingletonDavid_Singleton Member Posts: 5,479
    pdj wrote:
    I have a tabular form (a journal) with 30+ fields and a specific tab-order that jumps through 5 fields before jumping to a new line. This works fine. Now I need to add a column in the tab-order, but only if the user has made the column visible. First I simple added the column in the tab-order, but when the user doesn't show the colum it doesn't work. I have also tried setting the right control active in the OnDeactivate trigger, but that gives me a stack overflow error.

    Simple example:
    Type,No.(nextcontrol=Quantity),Description,Quantity(nextcontrol=No.)
    Now I need to add a column between Description and Quantity, which (when visible) should be in the tab-order.

    Any ideas on how to solve this, without making two forms?


    You can put code on the form in the onafterdecativate trigger to then activate the next field you want. Sorry I can't remember exactly now. I uploaded a sample form for this some years back, but can't find it right now.
    David Singleton
  • pdjpdj Member Posts: 643
    You can put code on the form in the onafterdecativate trigger to then activate the next field you want. Sorry I can't remember exactly now. I uploaded a sample form for this some years back, but can't find it right now.
    That was also my first suggestion, but I get a stack overflow error when trying. Do you re-call if you did it in a tabular or card form?
    matttrax wrote:
    In the OnActivate/Deactivate triggers for these columns and the one you show/hide you can make sure that the correct ones are visible.
    This actually sounds like a good idea! Thanks. My only problem is, that my requirements will require several dublicate fields, so it could be a bit messy. But I'll give it a try :-)
    Regards
    Peter
  • pdjpdj Member Posts: 643
    pdj wrote:
    matttrax wrote:
    In the OnActivate/Deactivate triggers for these columns and the one you show/hide you can make sure that the correct ones are visible.
    This actually sounds like a good idea! Thanks. My only problem is, that my requirements will require several dublicate fields, so it could be a bit messy. But I'll give it a try :-)
    This COULD be great idea, but NAV is to buggy ](*,) #-o
    It turns out that Currform.<control>.VISIBLE doesn't change, just because a user hides a column. :^o
    The user will have to close an re-open the form, to get it updated, but then it works like a charm. Thanks for your great suggestion =D>
    Regards
    Peter
  • matttraxmatttrax Member Posts: 2,309
    Not a good solution if they have to close and reopen the form. If they can remember to do that they can remember to hit TAB one more time
  • pdjpdj Member Posts: 643
    I agree :? It also ends up with atleast 9 speciale columns. Wouldn't like to be the next developer merging this object...
    I have informed the customer, that it IS possible, but will require a rather messy solution, and might cause issues for future feature requests and objects merging.
    Regards
    Peter
Sign In or Register to comment.