Hi

I created a radio group with 2 buttons (Yes/No)
Now depending which button is selected a field needs to change color.

I tried the following Listener (full code attached):

     tropicamideGroup.addListener(SWT.Selection, new Listener()
     {
        public void handleEvent(Event event)
        {
           switch (tropicamideGroup.getSelectionIndex())
           {
              case 0:
                 txtAuthorized.setBackground(SWTResourceManager.getColor(60, 
179, 113));
                 txtAuthorized.setText("\r\nAuthorized");
                 break;
              case 1:
                 
txtAuthorized.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));
                 txtAuthorized.setText("\r\nNot Authorized");
                 break;
           }
           // recreateAndLayout();
        }
     });


I tried also this version:

     tropicamideGroup.addSelectionListener(new SelectionAdapter()
     {
        @Override
        public void widgetSelected(SelectionEvent e)
        {
           RadioItem[] radioItems = tropicamideGroup.getItems();

           if (radioItems[0].equals(e.item))
           {
              txtAuthorized.setBackground(SWTResourceManager.getColor(60, 179, 
113));
              txtAuthorized.setText("\r\nAuthorized");
           }
           if (radioItems[1].equals(e.item))
           {
              
txtAuthorized.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));
              txtAuthorized.setText("\r\nNot Authorized");
           }
        }


none of them changes the color
what do i do wrong?

To participate in the discussion, go here: 
https://www.eclipse.org/forums/index.php?t=rview&frm_id=64
_______________________________________________
nebula-dev mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/nebula-dev

Reply via email to