I want to create two different group of radio buttons.
Suppose one group will set color option like: Red/Green/Blue,
second group will set option for trade like: Buy/Sell/Short/Cover.
I tried to do it with this code but I found that I am not able to group them because
I always have only one of the choice from entire two group options,
this mean if I choose any Color I loose selection from Trade(they all reset except the selected)
I tried to search in documentation/forum/google but I got no reference or hint.
Please suggest what am I missing here:
// note: we won't need the following four line of code if we could have some
// default background box that make the radio option visible just like other gui element
GfxSelectSolidBrush(colorLightYellow);
GfxRectangle(0, 100, 200, 200);
GfxSelectSolidBrush(colorPaleGreen);
GfxRectangle(0, 200, 200, 300);
// group 1 that define color option
if(GuiRadio("Red", 1, 0, 100, 100, 20, notifyClicked) == guinew)
{
GuiSetCheck(1, False);
}
if(GuiRadio("Green", 2, 100, 100, 100, 20, notifyClicked) == guinew)
{
GuiSetCheck(2, False);
}
// group 2 that define trade option
if(GuiRadio("Buy", 3, 0, 200, 100, 20, notifyClicked) == guinew)
{
GuiSetCheck(3, False);
}
if(GuiRadio("Sell", 4, 100, 200, 100, 20, notifyClicked) == guinew)
{
GuiSetCheck(4, False);
}
procedure handle_event()
{
for( i = 0; id = GuiGetEvent( i, 0 ); i++ )
{
code = GuiGetEvent( i, 1 );
text = GuiGetEvent( i, 2 );
switch(id)
{
// color
case 1:
GuiSetCheck(2, False);
break;
case 2:
GuiSetCheck(1, False);
break;
// trade
case 3:
GuiSetCheck(4, False);
break;
case 4:
GuiSetCheck(3, False);
break;
default:
break;
}
}
}
handle_event();
radio_1 = GuiGetCheck(1);
radio_2 = GuiGetCheck(2);
radio_3 = GuiGetCheck(3);
radio_4 = GuiGetCheck(4);
Title = StrFormat("Red:%g Green:%g\nBuy:%g Sell:%g", radio_1, radio_2, radio_3, radio_4);