Set focus on a specified field by currform.control.activate

willywilly Member Posts: 67
Hi!

Anonye tried to make a list form with the oppurtunity to search for a specified field and set focus on that field by code?

I need to avoid scrolling to much and wonder if there is a way to use the
currform.control.activate and put in the name of control I want by code.
(something like currform.MyValue.activate, where MyValue is the field I have entered in my search field).

I can get the field name and caption by searching through the Field table but haven't found a way to solve this problem.

Any ideas?

Comments

  • SavatageSavatage Member Posts: 7,142
    What's wrong with

    CTRL-F or F7

    ?
  • willywilly Member Posts: 67
    Hi! Maybe I did not explain what I wanted to do good enough.

    I want to search amoung the Colums in a list.

    For example in the Customer list (Form 22), I enter "Blocked" in my search field and I want the system to move the focus to that Column.
  • eclipseseclipses Member Posts: 8
    On the SubForm Set DelayedInsert to Yes, give a name for you column (MyColumn) and inserto into OnNewRecord trigger this code:

    IF CurrForm.ACTIVE THEN
    CurrForm.MyColumn.ACTIVATE;

    Bye
    Eclipses
  • garakgarak Member Posts: 3,263
    A "variable" CurrForm.MySpecificSearchFieldValue.activate is not possible, but you can use the following:

    MySpecificSearchFieldValue = Option (to avoid typing errors) -> Value are the coloumns that u will use (for example ,No.,Name,Phone No.)
    New TextBox with the MySpecificSearchFieldValue as seourceexpr.

    Then in the OnAfterValidate of the textBox you write the following
    <Control1119402000> - OnAfterValidate()
    case MySpecificSearchFieldValue of
      MySpecificSearchFieldValue::"":
        CurrForm.ACTIVATE;
      MySpecificSearchFieldValue::"No.":
        CurrForm."No.".ACTIVATE;
      MySpecificSearchFieldValue::"Name":
        CurrForm.Name.ACTIVATE;
      MySpecificSearchFieldValue::"Phone No.":
        CurrForm."Phone No.".ACTIVATE;
    end;
    

    Do you need this for setting a filter in this coloumn by using a other textbox where the user enter you filtercriteria?

    Regards
    Do you make it right, it works too!
  • KisuKisu Member Posts: 381
    Edit: Deleted my post, sorry didn't read carefully :mrgreen:
    K.S.
Sign In or Register to comment.