How to correctly pass values to UI macros?

Home Forums Problems and solutions in GDL Graphical UI and parameters list How to correctly pass values to UI macros?

This topic contains 2 replies, has 2 voices, and was last updated by  Tim Haering 1 year, 4 months ago.

  • Author
  • #4455

    Tim Haering

    Hey everyone,
    i’m having trouble wrapping my head arround some issues regarding interfaces called by macros and teir data. The situation:

    Main object

    I modified the UI code that sits in Macro3 and it is displayed fine in the UI of the main object. Now i would like to use the user set value from the main object UI in the 3D-Script of Macro3. Do i have to pass it as parameter all the way down the macro chain to make it work? Is the macro treated as a function of the main object? In that case it should be able to read the value in the main object which it doesn’t. This left me quite confused maybe someone could explain it in detail or point me out to a ressource helping me?
    Thanks in advance!

  • #4456

    Péter Baksa


    This works like in other languages’ function calls, just without the parentheses.
    To pass a parameter to a macro, use parameters all, or set it explicitly: call "macro" parameters p = p, .... The called macro’s unset parameters will be initialized to their default values visible in the parameter list.
    A macro doesn’t know about its caller’s parameters, so if it doesn’t have one, it can’t be passed further, and the lower macro’s parameter will be again initialized to its default value in the lower macro.
    So all the intermediate macros have to have the parameters that you are passing to the furthest one, and they have to be set in each macro call.

    Péter Baksa
    Software Engineer, Library Team

  • #4460

    Tim Haering

    Thanks for the help Peter! Your detailed explanation helped a lot.

You must be logged in to reply to this topic.