Subscribe Bookmark RSS Feed

Very Basic Modal Dialog Question

edzard_van_sant

Community Trekker

Joined:

Jun 4, 2014

Standard Dialog Box example:

Names Default To Here( 1 );

If(

    ex = Dialog(

        Title( " Dialog() example" ),

        vlist(

            hlist(

                "Set this value",

                variable = EditNumber( 42 )

            ),

            hlist(

                Button( "OK" ),

                Button( "Cancel" )

            )

        )

    );

    ex["button"] == 1;

,

    ex["variable"],

    "CANCEL"

);

How do I utilize the secret of the universe number in a table formula following the dialog?

2 REPLIES
dlee0416

Community Trekker

Joined:

Jun 11, 2014

I only spent literally a minute but maybe this will help..

If(

    ex = Dialog(

        Title( " Dialog() example" ),

        vlist(

            hlist(

                "Set this value",

                variable = EditNumber( 42 )

            ),

            hlist(

                Button( "OK" ),

                Button( "Cancel" )

            )

        )

    );

    ex["button"] == 1;

,

    ex["variable"],

    "CANCEL"

);

// I entered 33 versus the default of 42 and added the line at the bottom.

//  FYI. DIalog is depracated and New Window is encouraged.

x=ex["variable"];

pmroz

Super User

Joined:

Jun 23, 2011

Here's a version that uses new window instead of the old dialog.  The variable x is at your disposal after the dialog exits.

Names Default To Here( 1 );

ex = new window("Dialog() example", << modal(),

    vlistbox(

        hlistbox(

            textbox("Set this value"),

                variable_neb = numbereditbox( 42 )

        ),

        hlistbox(

            Button box( "OK",

                x = variable_neb << get;

            ),

            Button box( "Cancel",

                x = .;

            )

        )

    )

);