MUI : quelques exemples 

 

Dure la création de boîtes de dialogue! Nombreux sont ceux qui, sur Macintosh, préféraient faire appel aux ressources du système plutôt que d'utiliser les MIAW peu maniables et coûteuses en mémoire. Leur projet y perdait sa portabilité. Livrée avec la version 6 de Director, l'Xtra MUI prétend résoudre ce dilemme et faciliter enfin la création de dialogues système indépendants de la plate-forme utilisée. La programmation de l'Xtra plutôt mal documentée par Macromedia, à déjà été présentée dans un article d'initiation très détaillé (si, si !). Pour ceux qui veulent aller plus loin avec MUI, le CrapoWeb fournit ici quelques exemples.

Pour la bonne marche de ces exemple, on prendra la précaution de se procurer la dernière version de l'Xtra. Les premières version en effet comportaient un bug qui obligeait à intervertir le #mode: #pixel et le mode #dialogUnit lors lors de la création des dialogues.

Rappelons aussi qu'afin d'obtenir la création d'un dialogue, il faut passer à l'objet créé, sous forme d'arguments de la méthode Initialize(), deux listes de propriétés : #windowPropList et #windowItemList.

La propriété #callback définit le gestionnaire appelé incessament lorsque la boîte est ouverte et que l'utilisateur en manipule les contrôles. Ce gestionnaire à créer DOIT contenir une instruction stop( OBJET, 0) afin QUE L'ON PUISSE SORTIR DE LA BOITE. À défaut, sur Mac, la touche esc fermera la boîte.

Pour plus d'info sur la création de scripts exploitant MUI, on se reportera à l'article MUI.html du CrapoWeb. Ici était rassemblée TOUTE l'info disponible sur MUI.

 

 

 

set CRAPO to new(xtra "mui")

initialize(CRAPO, [#windowPropList: [#type: #normal, #name: "Un petite question", #callback: "mongestionnaire", #mode: #pixel, #xPosition: -1, #yPosition: -1, #width: 276, #height: 171, #modal: 1, #toolTips: 0, #closeBox: 1, #canZoom: 0], #windowItemList: [[#value: 0, #type: #WindowBegin, #attributes: [], #title: "title", #tip: "tip", #locH: 25, #locV: 25, #width: 200, #height: 25, #enabled: 1], [#value: 0, #type: #pushButton, #attributes: [], #title: "Annuler", #tip: "tip", #locH: 38, #locV: 134, #width: 80, #height: 20, #enabled: 1], [#value: 0, #type: #defaultPushButton, #attributes: [], #title: "Ok", #tip: "tip", #locH: 141, #locV: 134, #width: 80, #height: 20, #enabled: 1], [#value: 0, #type: #dividerH, #attributes: [], #title: "Push", #tip: "tip", #locH: 19, #locV: 115, #width: 236, #height: 1, #enabled: 1], [#value: "Votre texte ici", #type: #label, #attributes: [#textSize: #normal], #title: "Push", #tip: "tip", #locH: 25, #locV: 37, #width: 103, #height: 14, #enabled: 1], [#value: 0, #type: #WindowEnd, #attributes: [], #title: "title", #tip: "tip", #locH: 25, #locV: 25, #width: 200, #height: 25, #enabled: 1]]])

run(CRAPO)

set CRAPO to 0

 

 


 

 

set oDialog to new(xtra "mui")

initialize(oDialog, [#windowPropList: [#type: #normal, #name: "Deux choix", #callback: "toto", #mode: #pixel, #xPosition: -1, #yPosition: -1, #width: 488, #height: 169, #modal: 1, #toolTips: 0, #closeBox: 1, #canZoom: 0], #windowItemList: [[#value: 0, #type: #WindowBegin, #attributes: [], #title: "title", #tip: "tip", #locH: 25, #locV: 25, #width: 200, #height: 25, #enabled: 1], [#value: "Premier choix", #type: #label, #attributes: [#textSize: #normal], #title: "Push", #tip: "tip", #locH: 51, #locV: 59, #width: 95, #height: 14, #enabled: 1], [#value: "Deuxième choix", #type: #label, #attributes: [#textSize: #normal], #title: "Push", #tip: "tip", #locH: 42, #locV: 104, #width: 104, #height: 14, #enabled: 1], [#value: 0, #type: #IntegerSliderH, #attributes: [#valueRange: [#min: 0.0000, #max: 100, #increment: 1.0000, #jump: 10.0000, #acceleration: 0.5000], #sliderStyle: [#ticks]], #title: "Push", #tip: "tip", #locH: 164, #locV: 59, #width: 160, #height: 20, #enabled: 1], [#value: 0, #type: #IntegerSliderH, #attributes: [#valueRange: [#min: 0.0000, #max: 100, #increment: 1.0000, #jump: 10.0000, #acceleration: 0.5000], #sliderStyle: [#ticks]], #title: "Push", #tip: "tip", #locH: 164, #locV: 104, #width: 160, #height: 20, #enabled: 1], [#value: 0, #type: #dividerV, #attributes: [], #title: "Push", #tip: "tip", #locH: 352, #locV: 14, #width: 1, #height: 143, #enabled: 1], [#value: 0, #type: #pushButton, #attributes: [], #title: "Annuler", #tip: "tip", #locH: 377, #locV: 99, #width: 80, #height: 20, #enabled: 1], [#value: 0, #type: #defaultPushButton, #attributes: [], #title: "Ok", #tip: "tip", #locH: 377, #locV: 55, #width: 80, #height: 20, #enabled: 1], [#value: "Faites votre choix", #type: #label, #attributes: [#textSize: #normal], #title: "Push", #tip: "tip", #locH: 124, #locV: 18, #width: 121, #height: 14, #enabled: 1], [#value: 0, #type: #WindowEnd, #attributes: [], #title: "title", #tip: "tip", #locH: 25, #locV: 25, #width: 200, #height: 25, #enabled: 1]]])

run(oDialog)

set oDialog to 0

 


 

set CRAPO to new(xtra "mui")

initialize(CRAPO, [#windowPropList: [#type: #normal, #name: "Modifier tout", #callback: "BoiteOuverte", #mode: #pixel, #xPosition: -1, #yPosition: -1, #width: 373, #height: 237, #modal: 1, #toolTips: 0, #closeBox: 1, #canZoom: 0], #windowItemList: [[#value: 0, #type: #WindowBegin, #attributes: [], #title: "title", #tip: "tip", #locH: 25, #locV: 25, #width: 200, #height: 25, #enabled: 1], [#value: 0, #type: #pushButton, #attributes: [], #title: "Annuler", #tip: "tip", #locH: 25, #locV: 199, #width: 144, #height: 20, #enabled: 1], [#value: 0, #type: #defaultPushButton, #attributes: [], #title: "Ok", #tip: "tip", #locH: 195, #locV: 199, #width: 144, #height: 20, #enabled: 1], [#value: 0, #type: #dividerH, #attributes: [], #title: "Push", #tip: "tip", #locH: 19, #locV: 173, #width: 333, #height: 1, #enabled: 1], [#value: 1, #type: #checkBox, #attributes: [], #title: "Toujours avertir", #tip: "tip", #locH: 32, #locV: 133, #width: 0, #height: 0, #enabled: 0], [#value: "Nouveau nom ", #type: #label, #attributes: [#textSize: #normal], #title: "Push", #tip: "tip", #locH: 32, #locV: 26, #width: 94, #height: 14, #enabled: 1], [#value: "Sans titre", #type: #editText, #attributes: [#textSize: #normal], #title: "Push", #tip: "tip", #locH: 32, #locV: 53, #width: 250, #height: 20, #enabled: 1], [#value: "Note : 26 caractères maximum", #type: #label, #attributes: [#textSize: #tiny], #title: "Push", #tip: "tip", #locH: 31, #locV: 90, #width: 156, #height: 14, #enabled: 1], [#value: 0, #type: #WindowEnd, #attributes: [], #title: "title", #tip: "tip", #locH: 25, #locV: 25, #width: 200, #height: 25, #enabled: 1]]])

run(CRAPO)

set CRAPO to 0

 

 

Pour une étude approfondie des scripts MUI ou bien encore pour ne pas avoir à les rédiger, on se procurera avec profit l'Xtra Outil EasyDialog. EasyDialog vous laissera créer vos dialog en WYSIWYG et générera le script correspondant.