RADIOBUTTON - Utilisation
Rédigé par spheris
Aucun commentaire
Classé dans : apprentisssage, gambas 2, RadioButton, Tutoriel

Bonjour,
Dans ce petit exemple, nous allons essayer d 'utiliser le radiobutton, un widget qui permet de sélectionner tel ou tel événement dans un programme.
Les choses essentielles à retenir :
Deux radioboutons inter-agissent si ils sont dans le même parent ou container.
dans l 'exemple, si je clique sur bleu, L 'unou l 'autre ne sera pas désélectionné car ils ne sont pas dans le même container.
Le radiobutton reagira à lévènement Click la plupart du temps.
C 'est a peu prés tout ce qu 'il faut savoir dessus.
voici un petit exemple d 'application pour en démontrer les principales fonctions :
TELECHARGER LE FICHIER
A bientôtvoici le code de l 'application :
' Gambas class file
PUBLIC SUB Form_Open()
ME.Center
END
PUBLIC SUB Button1_Click()
ME.Close
END
PUBLIC SUB RadioButton1_Click()
lcouleur.Background = &h0000FF&
END
PUBLIC SUB RadioButton2_Click()
lcouleur.Background = &hFFFF00&
END
PUBLIC SUB RadioButton3_Click()
lcouleur.Background = &h00FF00&
END
PUBLIC SUB RadioButton4_Click()
lcouleur.Background = &hFF0000&
END
PUBLIC SUB RadioButton5_Click()
lcouleur.Background = &hFFBA00&
END
PUBLIC SUB RadioButton6_Click()
RadioButton6.X = RadioButton6.X + 3
END
PUBLIC SUB RadioButton7_Click()
RadioButton7.X = RadioButton7.X + 3
END
' Gambas class file
PUBLIC SUB _new()
END
PUBLIC SUB Form_Open()
ME.Center
END
PUBLIC SUB Button1_Click()
ME.Close
END
PUBLIC SUB RadioButton1_Click()
lcouleur.Background = &h0000FF&
END
PUBLIC SUB RadioButton2_Click()
lcouleur.Background = &hFFFF00&
END
PUBLIC SUB RadioButton3_Click()
lcouleur.Background = &h00FF00&
END
PUBLIC SUB RadioButton4_Click()
lcouleur.Background = &hFF0000&
END
PUBLIC SUB RadioButton5_Click()
lcouleur.Background = &hFFBA00&
END
PUBLIC SUB RadioButton6_Click()
RadioButton6.X = RadioButton6.X + 3
END
PUBLIC SUB RadioButton7_Click()
RadioButton7.X = RadioButton7.X + 3
END
