How to detect radial button selection after launching DB ?

I am writing a dxl that launches a dialog box which has multiple fields/tabs etc. .

I would like to find a way to enable my dxl to know when a user has selected a certain radioBox selection.

Currently, I am using an extra Dialog box button for " update " purposes. Currently, whenever the user selects a different radio selection they must then press this other button so that the call-back function executes.

Ideally, I would like the user to be able to select a different radioBox selection and have the dxl automatically execute a call back function.

Does anyone know of a way to do this?

A screen shot is attached if you would like to see what the box looks like. The "update" button and the current radio selections are highlighted.
Thanks
jmina - Thu Feb 09 21:03:19 EST 2012

Re: How to detect radial button selection after launching DB ?
llandale - Fri Feb 10 11:55:29 EST 2012

You can assign a "callback" function to most DBEs that fires when the value in the DBE changes. For radioBoxes its straight forward:

string sOptions[] = {"Option0", "Option1", "Option2"}
DB    dbBox
DBE   dbeRadio
void  clbkMyRadio(DBE dbeXX)
{
    int iSelected = get(dbeRadio)
    if (iSelected < 0) //
    then infoBox("Nothing is now selected")
    else infoBox("You just selected " iSelected "  " sOptions[iSelected] "")
}
 
dbBox = create("callback test")
dbeRadio = radioBox(dbBox, "Options", sOptions, 0)
set(dbeRadio, clbkMyRadio)    // Assign the callback
show(dbBox)


The callback function MUST have a single parameter DBE, which is the element selected. You could use that variable instead of the global dbeRadio, but since a callback is usually designed for a single element its easier to understand if you ignore the input parameter. if the callback is assigned to similar elements they you'd need to consider dbeXX.

-Louie