|
| Modifier la valeur ordre de création d'un champ d'état |
| Iniciado por Julien V, 30,oct. 2018 15:28 - 2 respuestas |
| |
| | | |
|
| |
Miembro registrado 134 mensajes |
|
| Publicado el 30,octubre 2018 - 15:28 |
Bonjour,
Je développe actuellement un éditeur de courrier dans une de mes applications.
Pour cela j'ai un état squelette où je rends manipulable (affichage, contenu) les champs libellés, images, états internes, code-barres et signature électronique.
Au premier chargement d'un état, je boucle sur ses champs pour les proposer dans une table avec le code suivant :
VariableRAZ( __parametres ) i = 1 champ = EnumèreChamp( MoiMême, i ) TANTQUE champ <> "" ( type, libelle ) = ChaîneDécoupe( champ, "_", "-" ) libelle = Remplace( libelle, "_", " " ) j = TableauAjoute( __parametres.champs ) AVEC __parametres.champs[ j ] .nom = champ .type = type .libelle = libelle SELON type CAS "LIB" : .valeur = { champ, indChamp }..Valeur CAS "ETATINT" : .valeur = { champ, indChamp }..NomEtatInterne FIN .Visible = { champ, indChamp }..Visible FIN i++ champ = EnumèreChamp( MoiMême, i ) FIN
Le problème avec ce type d'énumération c'est que par défaut on utilise l'ordre de création des champs. Ce qui fait qu'un champ positionné en début d'état mais créé en dernier apparaitra en fin de liste.
Cas concret : je veux réorganiser mes champs en fonction de la propriété visible avec le code suivant :
y = 0 i = 1 champ = EnumèreChamp( GR_corps, i ) TANTQUE champ <> "" SI { champ, indChamp }..Visible ALORS { champ, indChamp }..Y = y y += { champ, indChamp }..Hauteur FIN i++ champ = EnumèreChamp( GR_corps, i ) FIN Le champ LIB_sous_titre pourtant positionné en 2ème position dans mon groupe GR_corps se retrouve en dernière position.

Avec les champs d'état on ne peut pas utiliser parOrdreDeTabulation et parAltitude visuellement c'est le merdier à gérer.
Est-ce qu'il y a possibilité de modifier l'ordre de création d'un champ ? |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 134 mensajes |
|
| Publicado el 30,octubre 2018 - 16:00 |
Me réponds à moi même, j'ai une bidouille pour ce cas particulier
STChampTrie est une structure champ est une chaîne y est un entier FIN
champTrie est un STChampTrie champsTries est un tableau de 0 STChampTrie champ = EnumèreChamp( GR_corps, i ) TANTQUE champ <> "" VariableRAZ( champTrie ) champTrie.champ = champ champTrie.y = { champ, indChamp }..Y TableauAjoute( champsTries, champTrie ) i++ champ = EnumèreChamp( GR_corps, i ) FIN TableauTrie( champsTries, ttMembre, "y" )
POUR TOUT champTrie de champsTries SI { champTrie.champ, indChamp }..Visible ALORS { champTrie.champ, indChamp }..Y = y y += { champTrie.champ, indChamp }..Hauteur FIN FIN |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 134 mensajes |
|
| Publicado el 30,octubre 2018 - 16:48 |
Me re-réponds à moi même pour la présentation dans le tableau
STChampTrie est une structure ordre_bloc est un entier champ est une chaîne x est un entier y est un entier FIN champTrie est un STChampTrie champsTries est un tableau de 0 STChampTrie
i = 1 champ = EnumèreChamp( GR_entete, i ) TANTQUE champ <> "" VariableRAZ( champTrie ) champTrie.ordre_bloc = 1 champTrie.champ = champ champTrie.x = { champ, indChamp }..X champTrie.y = { champ, indChamp }..Y TableauAjoute( champsTries, champTrie ) i++ champ = EnumèreChamp( GR_entete, i ) FIN i = 1 champ = EnumèreChamp( GR_corps, i ) TANTQUE champ <> "" VariableRAZ( champTrie ) champTrie.ordre_bloc = 2 champTrie.champ = champ champTrie.x = { champ, indChamp }..X champTrie.y = { champ, indChamp }..Y TableauAjoute( champsTries, champTrie ) i++ champ = EnumèreChamp( GR_corps, i ) FIN i = 1 champ = EnumèreChamp( GR_pied, i ) TANTQUE champ <> "" VariableRAZ( champTrie ) champTrie.ordre_bloc = 3 champTrie.champ = champ champTrie.x = { champ, indChamp }..X champTrie.y = { champ, indChamp }..Y TableauAjoute( champsTries, champTrie ) i++ champ = EnumèreChamp( GR_pied, i ) FIN TableauTrie( champsTries, ttMembre, "ordre_bloc;y;x" ) POUR TOUT champTrie de champsTries ( type, libelle ) = ChaîneDécoupe( champTrie.champ, "_", "-" ) libelle = Remplace( libelle, "_", " " ) j = TableauAjoute( __parametres.champs ) AVEC __parametres.champs[ j ] .nom = champTrie.champ .type = type .libelle = libelle SELON type CAS "LIB" : .valeur = { champTrie.champ, indChamp }..Valeur CAS "ETATINT" : .valeur = { champTrie.champ, indChamp }..NomEtatInterne FIN .Visible = { champTrie.champ, indChamp }..Visible FIN FIN |
| |
| |
| | | |
|
| | | | |
| | |
|