Custom Ui Build On Demand!

Hi....

Im writing a code (its a auto rigger).
The principe is that you create member and after you can change option....

so in the window where you change options, you have to clic on a button who read all members in my scene, and in a for loop, it display them in a columnLayout.

There is that part of the script IN the layout....

CODE
//****************************************
//****************************************
//read routine
string $jointsList[] = ls -type joint;
int $getlevel;
string $getType;
int $i=0;
int $uiId;
global string $shareJoints[];

if ( $readMembers == 0)
{
    text -al "left" -l "\nPlease Read member from Scene (button above)\nto show here all members and modify them\nenjoy...";
}

for ($jointList in $jointsList)
{
    if ( ( attributeExists "KERmemberLevel" $jointList) && ( $readMembers == 1) )
    {
        $getlevel = getAttr ( $jointList + ".KERmemberLevel" );
        $getType = getAttr ( $jointList + ".KERtype" );

        if ( ( $getlevel == 1 ) && ( $getType == "arm") )
        {
            //BRAS
            //read option from scene
            $shareJoints[$i] = $jointList;
            int $KERArmOpt_fkik = getAttr ( $jointList + ".KERArmOpt\_fkik" );
            string $UIname = ($i + " : " + $jointList + "          [type : " + $getType + " ]");
            //apply them
            frameLayout -label $UIname -borderVisible 1 -borderStyle "in" -collapse 0 -collapsable 1;
                columnLayout;
                    radioButtonGrp -cc "" -label "control" -numberOfRadioButtons 3 -label1 "Fk" -label2 "Ik" -label3 "Fk/Ik" -select $KERArmOpt_fkik ("KERArmOpt_fkik"+$i);
                    rowLayout -numberOfColumns 3 -columnWidth3 200 113 112;
                        button -label "        -- Apply modif --" -w 200 -c "KERaction arm" ;
                        button -label "   Select member" -w 113 -c "global string $shareJoints[];select -r $shareJoints[$i];";
                        button -label "   Delete member" -w 112 -c "global string $shareJoints[];KERdetagThem $shareJoints[$i];";
                    setParent ..;
                setParent ..;
            setParent ..;
            //BRAS FIN

            $i++;
        }

    }
}
//end of read routine
//****************************************
//****************************************

the problem is that , when I put the button 'select memebers' it always select the first onject (with $i = 0).

How can I do to build a auto generated list in a UI, with button, etc.... and make in all of them a select button, who select a proper object! (understand?))

well, hope its clear...

thanks in advance