Make standard button inactive

Hi guys,

I have a simple dialogue box with a couple of standard buttons across the bottom. My question is, how can I disable (grey-out) one of these buttons until the user has populated the other dialogue fields?

In the code below, I want all three combo boxes to be given values by the user before the 'Test' button becomes available to press. The 'Close' button can remain active the whole time. I'm fine with writing the code to check that the combo boxes have been populated, but I just don't know how to make the 'Test' button inactive/active. I don't think I can use the 'void inactive(DBE)' function directly, because the 'Test' button isn't set up as a DBE. Or can I?

// Variables
string options1[] = {"00", "01", "02"}
string options2[] = {"Test1", "Test2"}
string options3[] = {"Value1", "Value2", "Value3"}
string selection1 = null
string selection2 = null
string selection3 = null

// Create dialogue box
DB dialogue = create("Dialogue", styleStandard|styleFixed|styleCentred)
label(dialogue, "Please select the following settings.")
DBE combo1 = choice(dialogue, "Option 1: ", options1, -1, 10, false)
DBE combo2 = choice(dialogue, "Option 2: ", options2, -1, 10, false)
DBE combo3 = choice(dialogue, "Option 3: ", options3, -1, 10, false)

// Combo boxes processing callback function
void clbkProcessComboBoxes(DBE)
{
    // Check that all combo boxes have had a selection made
    // and then make Test button active
}

// Dialogue callback function
void clbkDialogue(DB dialogue)
{
        // Get combo box selections
        selection1 = get(combo1)
        selection2 = get(combo2)
        selection3 = get(combo3)

        // Print combo box selections
        print selection1 "\n"
        print selection2 "\n"
        print selection3 "\n"
}

// Set up combo boxes processing callback
set(combo1, clbkProcessComboBoxes)
set(combo2, clbkProcessComboBoxes)
set(combo3, clbkProcessComboBoxes)

// Prompt user for settings
ok(dialogue, "Test", clbkDialogue)
show dialogue

Thanks heaps for your assistance!

Matt


MattHellyer - Tue May 27 05:18:02 EDT 2014

Re: Make standard button inactive
Tony_Goodman - Tue May 27 08:42:57 EDT 2014

The ok function returns a handle on the DBE as follows:

DBE dbeTestButton = ok("Test", clbkDialogue)

Then inactive(dbeTestButton) will work.

Tony

Re: Make standard button inactive
MattHellyer - Tue May 27 20:28:22 EDT 2014

Tony_Goodman - Tue May 27 08:42:57 EDT 2014

The ok function returns a handle on the DBE as follows:

DBE dbeTestButton = ok("Test", clbkDialogue)

Then inactive(dbeTestButton) will work.

Tony

Thanks Tony, that worked perfectly!

I didn't even think to look at the ok() return type. Now that I look carefully, it does show it in the DXL Reference Manual, but it doesn't discuss it in the description or use it in the example which is why I didn't notice it.

Thanks again,

Matt