IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaFX Discussion :

TreeView avec checkbox seulement sur les leafs


Sujet :

JavaFX

  1. #1
    Membre régulier

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2014
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2014
    Messages : 24
    Points : 120
    Points
    120
    Par défaut TreeView avec checkbox seulement sur les leafs
    Bonjour,

    je suis en train de programmer un TreeView pour lister les voix de synthèses vocales présentes sur le système d'exécution.
    Ma fenêtre ressemble à ça pour le moment :
    Nom : ttsConfigDialog.png
Affichages : 1166
Taille : 78,9 Ko

    Le problème que j'ai, c'est que je voudrais avoir les checkbox que sur les leafs de chaque arbres.
    Par exemple sur "Microsoft Zira Desktop...", "Microsoft David Desktop...", "Microsoft Hortense Desktop, SAPI5, Microsoft", etc.
    J'ai beau chercher, je ne trouve pas la solution...

    Voici mon code:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
     
    /**
             * Retrieving available voices on the system, 
             * and populating the TreeView 
             */
    	private void LoadTTSVoiceTree() {
    		TreeItem<String> rootItem = new TreeItem<String>("Moteurs de synthèse vocale disponibles");
    		rootItem.setExpanded(true);
     
    		EngineList list = Central.availableSynthesizers(null);
            for(int i = 0; i<list.size(); i++) {
            	EngineModeDesc engineDesc = (EngineModeDesc) list.get(i);
            	String engineName = engineDesc.getEngineName();
            	String engineMode = engineDesc.getModeName();
            	Locale engineLocale = engineDesc.getLocale();
            	TreeItem<String> engineItem = new TreeItem<String>(engineName +" - "+ engineMode +" - "+ engineLocale.getDisplayLanguage().toUpperCase());
     
                rootItem.getChildren().add(engineItem);
                engineItem.setExpanded(true); 
                //System.out.println(engineName + " - " + engineLocale);		
     
                SynthesizerModeDesc desc = (SynthesizerModeDesc)list.get(i);
                try {
                    Synthesizer synth = Central.createSynthesizer(desc);
                    synth.allocate();
                    synth.resume();
                    synth.waitEngineState(Synthesizer.ALLOCATED);
                    desc = (SynthesizerModeDesc)synth.getEngineModeDesc();
                    Voice[] vs = desc.getVoices();
                    for(Voice v: vs) {
                        //System.out.println("Found voice \""+vs[j].getName()+"\"");
                    	String voiceName = v.getName();
                    	CheckBoxTreeItem<String> voiceItem = new CheckBoxTreeItem<String>(voiceName);
                    	engineItem.getChildren().add(voiceItem);
                    }
                    synth.deallocate();
                    synth.waitEngineState(Synthesizer.DEALLOCATED);
                } catch(Exception e) {
                    e.printStackTrace();
                }
            }
     
            ttsVoiceTree.setRoot(rootItem);
            ttsVoiceTree.setCellFactory(CheckBoxTreeCell.<String>forTreeView());
    	}
    En espérant qu'une solution existe...
    Merci de vos bon conseils !

  2. #2
    Membre régulier

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2014
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2014
    Messages : 24
    Points : 120
    Points
    120
    Par défaut
    Rebonjour,

    Alors j'ai trouvé ma solution. Je me suis fait un custom TreeCell que j'ai utilisé dans le setCellFactory de mon TreeView.

    Maintenant, je me demande comme faire pour capter les selected sur mes TreeItem/TreeCell...

  3. #3
    Rédacteur/Modérateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Août 2005
    Messages
    6 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Nouvelle-Calédonie

    Informations professionnelles :
    Activité : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Août 2005
    Messages : 6 840
    Points : 22 854
    Points
    22 854
    Billets dans le blog
    51
    Par défaut
    2 approches possibles parmi d'autres :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    package treecheck;
     
    import java.util.function.Function;
    import java.util.stream.IntStream;
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.beans.property.BooleanProperty;
    import javafx.beans.property.SimpleBooleanProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.collections.MapChangeListener;
    import javafx.collections.ObservableMap;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.CheckBox;
    import javafx.scene.control.Label;
    import javafx.scene.control.SplitPane;
    import javafx.scene.control.TreeCell;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.TreeView;
    import javafx.scene.layout.Priority;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
     
    public final class Main extends Application {
     
        private static final short MAX_TREE_DEPTH = 3;
     
        @Override
        public void start(final Stage primaryStage) throws Exception {
            // Écouteur cellule.
            final Label trucTitleLabel = new Label("Écouteur cellule");
            final Label trucLabel = new Label();
            final TreeView<Truc> trucTreeView = new TreeView(createTree(id -> {
                final Truc result = new Truc(id);
                result.selectedProperty().addListener((observable, oldValue, newValue) -> {
                    trucLabel.setText(String.format("%s - %b", result, result.isSelected()));
                });
                return result;
            }));
            trucTreeView.setShowRoot(false);
            trucTreeView.setCellFactory(tree -> new TrucTreeCell());
            VBox.setVgrow(trucTreeView, Priority.ALWAYS);
            final VBox trucVBox = new VBox();
            trucVBox.getChildren().addAll(trucTitleLabel, trucTreeView, trucLabel);
            // Map de sélection.
            final Label totoTitleLabel = new Label("Map de sélection");
            final Label totoLabel = new Label();
            final TreeView<Toto> tototTreeView = new TreeView(createTree(Toto::new));
            tototTreeView.setShowRoot(false);
            final ObservableMap<Toto, Boolean> totoSelectionMap = FXCollections.observableHashMap();
            totoSelectionMap.addListener((MapChangeListener.Change<? extends Toto, ? extends Boolean> change) -> {
                totoLabel.setText(String.format("%s - %b", change.getKey(), change.getValueAdded()));
            });
            tototTreeView.setCellFactory(tree -> new TotoTreeCell(totoSelectionMap));
            VBox.setVgrow(tototTreeView, Priority.ALWAYS);
            final VBox totoVBox = new VBox();
            totoVBox.getChildren().addAll(totoTitleLabel, tototTreeView, totoLabel);
            //
            final SplitPane root = new SplitPane();
            root.getItems().addAll(trucVBox, totoVBox);
            final Scene scene = new Scene(root);
            primaryStage.setScene(scene);
            primaryStage.setWidth(500);
            primaryStage.setHeight(800);
            primaryStage.show();
            Platform.runLater(() -> root.setDividerPositions(0.5));
        }
     
        private <T> TreeItem<T> createTree(final Function<String, T> provider) {
            final TreeItem<T> root = new TreeItem<>();
            populateTree(root, provider, MAX_TREE_DEPTH, "");
            return root;
        }
     
        private <T> void populateTree(final TreeItem<T> root, final Function<String, T> provider, final int level, final String prefix) {
            IntStream.range(0, level)
                    .mapToObj(index -> String.format("%s %d", prefix, index).trim())
                    .map(provider::apply)
                    .map(TreeItem::new)
                    .forEach(item -> {
                        populateTree(item, provider, level - 1, item.getValue().toString());
                        root.getChildren().add(item);
                    });
            root.setExpanded(true);
        }
     
        private static final class Truc {
     
            final String id;
     
            public Truc(final String id) {
                this.id = id;
            }
     
            @Override
            public String toString() {
                return id;
            }
     
            private final BooleanProperty selected = new SimpleBooleanProperty(this, "selected");
     
            public final boolean isSelected() {
                return selected.get();
            }
     
            public final void setSelected(boolean value) {
                selected.set(value);
            }
     
            public final BooleanProperty selectedProperty() {
                return selected;
            }
        }
     
        private static final class TrucTreeCell extends TreeCell<Truc> {
     
            private CheckBox renderer = null;
     
            private Truc currentItem;
     
            @Override
            protected void updateItem(Truc item, boolean empty) {
                super.updateItem(item, empty);
                currentItem = item;
                String text = null;
                Node graphic = null;
                if (item != null && !empty) {
                    final TreeItem treeItem = getTreeItem();
                    final boolean isLeaf = treeItem.isLeaf();
                    if (isLeaf) {
                        renderer = (renderer == null) ? new CheckBox() : renderer;
                        renderer.selectedProperty().removeListener(selectedChangeListener);
                        renderer.setText(item.toString());
                        renderer.setSelected(item.isSelected());
                        renderer.selectedProperty().addListener(selectedChangeListener);
                        text = null;
                        graphic = renderer;
                    } else {
                        text = item.toString();
                    }
                }
                setText(text);
                setGraphic(graphic);
            }
     
            private final ChangeListener<Boolean> selectedChangeListener = (observable, oldValue, newValue) -> {
                if (currentItem != null) {
                    currentItem.setSelected(newValue);
                }
            };
        }
     
        private static final class Toto {
     
            final String id;
     
            public Toto(final String id) {
                this.id = id;
            }
     
            @Override
            public String toString() {
                return id;
            }
        }
     
        private static final class TotoTreeCell extends TreeCell<Toto> {
     
            private CheckBox renderer = null;
     
            private Toto currentItem;
     
            final ObservableMap<Toto, Boolean> selectionMap;
     
            public TotoTreeCell(final ObservableMap<Toto, Boolean> selectionMap) {
                this.selectionMap = selectionMap;
            }
     
            @Override
            protected void updateItem(Toto item, boolean empty) {
                super.updateItem(item, empty);
                currentItem = item;
                String text = null;
                Node graphic = null;
                if (item != null && !empty) {
                    final TreeItem treeItem = getTreeItem();
                    final boolean isLeaf = treeItem.isLeaf();
                    if (isLeaf) {
                        renderer = (renderer == null) ? new CheckBox() : renderer;
                        renderer.selectedProperty().removeListener(selectedChangeListener);
                        renderer.setText(item.toString());
                        final Boolean selected = selectionMap.get(item);
                        renderer.setSelected(selected == null ? false : selected);
                        renderer.selectedProperty().addListener(selectedChangeListener);
                        text = null;
                        graphic = renderer;
                    } else {
                        text = item.toString();
                    }
                }
                setText(text);
                setGraphic(graphic);
            }
     
            private final ChangeListener<Boolean> selectedChangeListener = new ChangeListener<Boolean>() {
                @Override
                public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
                    if (currentItem != null) {
                        selectionMap.put(currentItem, newValue);
                    }
                }
            };
        }
     
        public static void Main(String... args) {
            Application.launch(args);
        }
    }
    Merci de penser au tag quand une réponse a été apportée à votre question. Aucune réponse ne sera donnée à des messages privés portant sur des questions d'ordre technique. Les forums sont là pour que vous y postiez publiquement vos problèmes.

    suivez mon blog sur Développez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

  4. #4
    Membre régulier

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2014
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2014
    Messages : 24
    Points : 120
    Points
    120
    Par défaut
    Merci Bouye pour les exemples de code, tu t'es bien impliqué pour me fournir des exemples de code.

    Je vous montre ici, le code sur lequel je me suis arrêté.
    Je me suis rendu compte que je n'avait pas vraiment besoin d'écouté le ChangeListener du TreeCell.
    Et puis j'utilise maintenant des RadioButton au lieu de CheckBox, car dans mon TreeView, l'utilisateur ne doit pas pouvoir coché plus d'un item.

    Là où j'aimerais encore tes lumières, c'est que j'ai déclaré mon ToggleGroup au niveau de ma fenêtre, et je le passe par le constructeur à mon VoiceCell (extends TreeCell) dans lequel, j'y insère les références de mes RadioButton au fur et à mesure qu'ils sont ajouté.

    Je ne sais pas s'il s'agit d'une bonne pratique, mais j'ai peur de faire de l'antipattern, si vous pouviez me rassurer sur ce point et m'éclairer sur la/les corrections à apporter également.

    Voici mon code actuel:

    TTSConfigDialog.java
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
     
    package experimentation.configdialog;
     
    import java.io.IOException;
    import java.util.Locale;
     
    import javax.speech.Central;
    import javax.speech.EngineList;
    import javax.speech.EngineModeDesc;
    import javax.speech.synthesis.Synthesizer;
    import javax.speech.synthesis.SynthesizerModeDesc;
    import javax.speech.synthesis.Voice;
     
    import javafx.application.Application;
    import javafx.fxml.FXML;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Toggle;
    import javafx.scene.control.ToggleGroup;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.TreeView;
    import javafx.scene.layout.AnchorPane;
    import javafx.stage.Stage;
     
    public class TTSConfigDialog extends Application {
     
    	ToggleGroup radioGroup = new ToggleGroup();
    	String selectedVoice = "";
     
    	private Stage primaryStage;
     
    	@FXML
    	private AnchorPane configDialogLayout;
     
    	@FXML
    	private TreeView<String> ttsVoiceTree;
     
    	@FXML
    	private Button btnApply;
    	@FXML
    	private Button btnCancel;
     
    	@FXML
    	private void btnApplyAction() {
    		Toggle selectedRadio = radioGroup.getSelectedToggle();
        	if (selectedRadio != null)
        		setVoiceSelected((String)selectedRadio.getUserData());
     
    		Stage stage = (Stage) btnApply.getScene().getWindow();
    	    stage.close();  
    	}
     
    	@FXML
    	private void btnCancelAction() {
    		Stage stage = (Stage) btnApply.getScene().getWindow();
    	    stage.close(); 
    	}
     
    	void setVoiceSelected(String voice) {
    		selectedVoice = voice;
    		System.out.println(selectedVoice);
    	}
     
    	/**
             * Retrieving available voices on the system, 
             * and populating the TreeView 
             */
    	private void LoadTTSVoiceTree() {
    		TreeItem<String> rootItem = new TreeItem<String>("Moteurs de synthèse vocale disponibles");
    		rootItem.setExpanded(true);
     
    		EngineList list = Central.availableSynthesizers(null);
            for(int i = 0; i<list.size(); i++) {
            	EngineModeDesc engineDesc = (EngineModeDesc) list.get(i);
            	String engineName = engineDesc.getEngineName();
            	String engineMode = engineDesc.getModeName();
            	Locale engineLocale = engineDesc.getLocale();
            	TreeItem<String> engineItem = new TreeItem<String>(engineName +" - "+ engineMode +" - "+ engineLocale.getDisplayLanguage().toUpperCase());
     
                rootItem.getChildren().add(engineItem);
                engineItem.setExpanded(true); 		
     
                SynthesizerModeDesc desc = (SynthesizerModeDesc)list.get(i);
                try {
                    Synthesizer synth = Central.createSynthesizer(desc);
                    synth.allocate();
                    synth.resume();
                    synth.waitEngineState(Synthesizer.ALLOCATED);
                    desc = (SynthesizerModeDesc)synth.getEngineModeDesc();
                    Voice[] vs = desc.getVoices();
                    for(Voice v: vs) {
                    	String voiceName = v.getName();
                    	TreeItem<String> voiceItem = new TreeItem<String>(voiceName);
                    	engineItem.getChildren().add(voiceItem);
                    }
                    synth.deallocate();
                    synth.waitEngineState(Synthesizer.DEALLOCATED);
                } catch(Exception e) {
                    e.printStackTrace();
                }
            }
     
            ttsVoiceTree.setRoot(rootItem);
            ttsVoiceTree.setCellFactory(e -> new VoiceCell(/*this*/ radioGroup));
     
    	}
     
    	/**
             * Loading the FXML layout file
             */
    	private void initLayout() {		
    		try {
    			FXMLLoader loader = new FXMLLoader();
    			loader.setLocation(TTSConfigDialog.class.getResource("TTSConfigDialogLayout.fxml"));
    			configDialogLayout = (AnchorPane) loader.load();
     
    			Scene scene = new Scene(configDialogLayout);
    			primaryStage.setScene(scene);
    			primaryStage.show();
     
    			TTSConfigDialog controller = loader.getController();
    			controller.LoadTTSVoiceTree();
     
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
     
    	@Override
    	public void start(Stage primaryStage) {
    		this.primaryStage = primaryStage;
    		this.primaryStage.setTitle("Configuration de la voix de la synthèse vocale");
     
    		initLayout();
     
    	}
     
    	public static void main(String[] args) {
    		launch(args);
    	}
    }
    VoiceCell.java
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    package experimentation.configdialog;
     
    import javafx.scene.control.Label;
    import javafx.scene.control.RadioButton;
    import javafx.scene.control.ToggleGroup;
    import javafx.scene.control.TreeCell;
    import javafx.scene.layout.HBox;
     
    /**
     * A custom cell that shows a checkbox and label in the
     * TreeCell.
     */
    public class VoiceCell extends TreeCell<String> {
     
    	ToggleGroup group;
     
    	VoiceCell(ToggleGroup group) {
    		super();
    		this.group = group;
    	}
     
     
        @Override
        protected void updateItem(String text, boolean empty) {
            super.updateItem(text, empty);
     
            // If the cell is empty we don't show anything.
            if (isEmpty()) {
                setGraphic(null);
                setText(null);
            } else {
                // We only show the custom cell if it is a leaf, meaning it has
                // no children.
                if (this.getTreeItem().isLeaf()) {
     
                    // A custom HBox that will contain your check box, label and
                    // button.
                    HBox cellBox = new HBox(10);
     
                    //CheckBox checkBox = new CheckBox();
                    RadioButton radioBtn = new RadioButton();
                    radioBtn.setToggleGroup(group);
                    radioBtn.setUserData(text);
                    Label label = new Label(text);
     
                    // Here we bind the pref height of the label to the height of the checkbox. This way the label and the checkbox will have the same size. 
                    label.prefHeightProperty().bind(radioBtn.heightProperty());
     
                    cellBox.getChildren().addAll(radioBtn, label);
     
                    // We set the cellBox as the graphic of the cell.
                    setGraphic(cellBox);
                    setText(null);
                } else {
                    // If this is the root we just display the text.
                    setGraphic(null);
                    setText(text);
                }
            }
        }
    }

  5. #5
    Rédacteur/Modérateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Août 2005
    Messages
    6 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Nouvelle-Calédonie

    Informations professionnelles :
    Activité : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Août 2005
    Messages : 6 840
    Points : 22 854
    Points
    22 854
    Billets dans le blog
    51
    Par défaut
    Note : pas vraiment besoin d'invoquer isEmpty() puisque tu reçois une variable empty juste au-dessus.

    Les patterns c'est bien mais est-ce vraiment besoin d'en mettre dans le code interne d'un contrôle qui ne sera jamais réutilisé ailleurs ? C'est plutôt là question que tu devrais te poser : est-ce qu'ici le l'effort est vraiment nécessaire ?

    Sinon tu devrais te créer une fabrique a cellule, qui encapsulera le ToggleGroup le rendant ainsi invisible et qui disposera d'une propriété permettant de retrouver l’élément sélectionner. Évidement après il faudra aussi généricifier le code pour que le principe puisse être découplé de tes données et que la fabrique puisse être réutilisable ailleurs. Alors oui bien sur c'est possible mais bon... on a beau vouloir rajouter 36 couches de strass quelque part sous le capot, le lustre et les chromes, a un moment ou a un autre il y a du cambouis, de la graisse, des tuyaux qui fuient et des boulons... A ce niveau-la, le jeu en vaut-il la chandelle ? Si oui alors go, si non et que ça marche très bien comme ça sans pour autant être un trou de sécurité ou de performance, pas la peine d'y toucher.
    Merci de penser au tag quand une réponse a été apportée à votre question. Aucune réponse ne sera donnée à des messages privés portant sur des questions d'ordre technique. Les forums sont là pour que vous y postiez publiquement vos problèmes.

    suivez mon blog sur Développez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

  6. #6
    Membre régulier

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2014
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2014
    Messages : 24
    Points : 120
    Points
    120
    Par défaut
    Merci boucoup!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. treeview avec checkbox que sur certains noeuds
    Par petitours dans le forum C#
    Réponses: 4
    Dernier message: 02/11/2013, 19h51
  2. [WinForm] TreeView avec checkbox grisée
    Par Thor Tillas dans le forum Visual C++
    Réponses: 2
    Dernier message: 22/03/2007, 13h27
  3. vb.net : treeview avec checkbox
    Par 1coni dans le forum Windows Forms
    Réponses: 11
    Dernier message: 31/05/2006, 13h18
  4. [C#] TreeView avec CheckBox à certain niveaux
    Par Maxsin dans le forum Windows Forms
    Réponses: 3
    Dernier message: 28/04/2006, 16h29
  5. [C#] TreeView avec CheckBox "indeterminate"
    Par padumeur dans le forum Windows Forms
    Réponses: 3
    Dernier message: 27/01/2005, 20h53

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo