Bonjour,
Ci dessous un petit code pour afficher la liste des raccourcis clavier d'une fenêtre.
Merci à ceux qui ont répondu au post https://forum.pcsoft.fr/fr-FR/pcsoft.fr.windev/240929-raccourcis-clavier/read.awp
Soit :
- constantesTouches un tableau associatif de chaines reprenant les constantes de KeyConst.wl
ex.
constantesTouches[ 0x0D ] = "Entrée"
- gproc_traduire_toucheRaccourci qui traduit le numéro de la propriété ..ToucheRaccourci en chaine
- gproc_afficher_touchesRaccourcis qui renvoie une info listant tous les raccourcis
Procedure gproc_traduire_toucheRaccourci( _toucheRaccourci est un entier, _libelle est une chaîne = "" )
i, iMax est un entier
toucheRaccourci, valeurSansPoidsFaible est un entier
libelle, toucheControle, toucheCaractere, toucheConstante est une chaîne
combinaison est un tableau de 0 chaîne
avecEtCommercial est un booléen
toucheRaccourci = _toucheRaccourci
libelle = _libelle
SI toucheRaccourci = 65535 _ET_ libelle <> "" ALORS
iMax = Taille( libelle )
POUR i = 1 À iMax
SI libelle[ i ] = "&" ALORS
avecEtCommercial = PAS avecEtCommercial
SINON SI avecEtCommercial ALORS
TableauAjoute( combinaison, "Alt + " + libelle[ i ] )
SORTIR
FIN
FIN
SINON
valeurSansPoidsFaible = Val( toucheRaccourci - PoidsFaible( toucheRaccourci ) )
SELON valeurSansPoidsFaible
CAS trAlt : toucheControle = "Alt"
CAS trControl : toucheControle = "Ctrl"
CAS trShift : toucheControle = "Maj"
AUTRE CAS : toucheControle = ""
FIN
SI toucheControle <> "" ALORS TableauAjoute( combinaison, toucheControle )
SI PoidsFaible( toucheRaccourci ) >= 0 ET PoidsFaible( toucheRaccourci ) <= 255 ALORS
toucheConstante = COL_Outils.constantesTouches[ PoidsFaible( toucheRaccourci ) ]
SI toucheConstante <> "" ALORS
TableauAjoute( combinaison, toucheConstante )
SINON
toucheCaractere = Caract( PoidsFaible( toucheRaccourci ) )
SI toucheCaractere <> "" ALORS
TableauAjoute( combinaison, toucheCaractere )
FIN
FIN
FIN
FIN
RENVOYER TableauVersChaîne( combinaison, " + " )
Procedure gproc_afficher_touchesRaccourcis( _fenetreInterne est un Champ )
raccourcis est un tableau de chaîne
iproc_enumereChamp( _fenetreInterne )
SI TableauOccurrence( raccourcis ) > 0 ALORS
TitreSuivant( "Raccourcis clavier" )
Info( TableauVersChaîne( raccourcis, CR ) )
FIN
PROCEDURE INTERNE iproc_enumereChamp( LOCAL _parent est un Champ )
i est un entier
champ, libelle, raccourci est une chaîne
parents est un tableau de Champ
c est un Champ
i = 1
champ = EnumèreChamp( _parent, i )
TANTQUE champ <> ""
c <- EnumèreChamp( _parent, i )
SI c..Type DANS ( typDisposition, typFen, typGrp, typFenêtreInterne, typModèleDeChamp, typOnglet, typRegroupementRuban, typRuban, typSuperChamp, typTiroir, typVoletOnglet, typZoneMultiligne, typZoneRépétée ) ALORS
TableauAjoute( parents, c )
SINON
SI c..ToucheRaccourci <> 0 ALORS
raccourci = gproc_traduire_toucheRaccourci( c..ToucheRaccourci, c..Libellé )
SI raccourci <> "" ALORS
SELON c..Type
CAS typBouton : libelle = "Bouton"
CAS typComboAVS, typComboSNS, typListe, typListeImage : libelle = "Liste"
CAS typInterr, typInterrupteurABascule : libelle = "Interrupteur"
CAS typSelect : libelle = "Sélecteur"
AUTRE CAS : libelle = "Champ"
FIN
SI c..Libellé <> "" ALORS
libelle += [ " " ] + c..Libellé
SINON
libelle += [ " " ] + champ
FIN
TableauAjoute( raccourcis, libelle + " : " + raccourci )
FIN
FIN
FIN
i++
champ = EnumèreChamp( _parent, i )
FIN
POUR TOUT parent de parents
iproc_enumereChamp( parent )
FIN
FIN
Et le résultat :

