Options

Making columns visible/invisible on runtime in a subform

MymoonMymoon Member Posts: 6
Hi,
i have a main-form and a subform on it. There are two radio buttons on the main form.
When I choose one of radio buttons on main-form, i want one of my subform's colums to be visible and another invisible. When i choose the other radio button, i want to reverse each other.

Does anyone have a solution for it?

{
This is what i have done:
I first read the parameter via radio buttons and activated the subform control of main-form.
On-activate trigger of subform, i called a function from main-form to read the parameter. But the parameter brings its default value all the time. So it doesnt work to set the visible property of columns using the parameter.

I tried to understand how CodeUnit 408 (Dimension Management) is working. But it looks complex.
}

Any idea, solution or knowledge about CodeUnit408 is wellcomed.
Thank you...

Comments

  • Options
    kvbkvb Member Posts: 107
    as easy as ABC! :D

    In your subform create a function like this:
    SetColumnVisible(Par : Option)
    CASE Par OF
      0:BEGIN
        CurrForm.Column1.VISIBLE := TRUE;
        CurrForm.Column2.VISIBLE := FALSE;
      END;
      1:BEGIN
        CurrForm.Column1.VISIBLE := FALSE;
        CurrForm.Column2.VISIBLE := TRUE;
      END;
    END;
    

    In main-form in radiobutton`s trigger OnAfterValidate write this code:
    CurrForm.SalesLines.FORM.SetColumnVisible(YourOptionVariable);
    

    You must write those code two times for each radiobutton`s OnAfterValidate trigger.

    Make sure that you correctly fill SourceExpr and OptionValue properties of radiobuttons.
  • Options
    MymoonMymoon Member Posts: 6
    Hello and thanx a lot 8)

    Actually it was the first method i've tried but with one difference.

    In radio-buttons validate trigger, i called the subform's function directly like this:
    SalesOrder.SetColumnVisible(OptionVariable);
    

    There was no change in columns after that. So i thought that i cant change the visibility of columns without activating the form.

    Thanks again...
  • Options
    kvbkvb Member Posts: 107
    So i thought that i cant change the visibility of columns without activating the form

    Believe me - you can do it since i`ve done it! :D

    Just do it in exactly same way that i say.
    You need OnAfterValidate trigger.
Sign In or Register to comment.