Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

AppleScript popup menu

4 réponses
Avatar
yvon.thoravalNO-SPAM
j'ai un popup menu que je set comme ça :

set countryLabel to {"Deutschland", "France", "Great Britain",
"Italia", "USA"}
set countryValue to {"DE", "FR", "GB", "IT", "US"}
tell panelWIndow
delete every menu item of menu of popup button "country"
repeat with i from 1 to (length of countryLabel)
if (item i of countryValue) = country then
set isOn to 1
else
set isOn to 0
end if
make new menu item at the end of menu items of menu of popup button
"country" with properties {title:(item i of countryLabel), state:(isOn),
enabled:true}
end repeat
end tell


la bonne "country" est sélectionnée (un tick en face) mais elle
n'apparaît pas par défaut dans le popup ça laisse passer qu'une autre
est sélectionnée.

si par ex country = "FR", c'est bien l'item "FR" qui est tické mais ça
reste qd même "DE", le premier dans la liste qui apparaît.

y a t'il un moyen de changer cela ???

--
yt

4 réponses

Avatar
Patrick Stadelmann
In article <1gcgdsr.qcnc05u0eltuN%,
(Yvon Thoraval) wrote:

la bonne "country" est sélectionnée (un tick en face) mais elle
n'apparaît pas par défaut dans le popup ça laisse passer qu'une autre
est sélectionnée.

si par ex country = "FR", c'est bien l'item "FR" qui est tické mais ça
reste qd même "DE", le premier dans la liste qui apparaît.

y a t'il un moyen de changer cela ???


Il faut utiliser "set current item"

Patrick
--
Patrick Stadelmann

Avatar
yvon.thoravalNO-SPAM
Patrick Stadelmann wrote:

Il faut utiliser "set current item"


ok tanxs
--
yt

Avatar
yvon.thoravalNO-SPAM
Patrick Stadelmann wrote:

Il faut utiliser "set current item"


ok j'ai essayé ca :

set current menu item of menu of popup button "country" to menu item j
of menu of popup button "country"

(suivant
http://developer.apple.com/documentation/AppleScript/Reference/StudioRef
erence/sr5_control_suite/chapter_5_section_16.html)

mais ca me donne cette erreur à l'init du popup :

NSConnotCreateScriptCommandError (10)

je précise que le set current menu item est à l'intérieur de :

tell panelWIndow
[...]
end tell
--
yt

Avatar
yvon.thoravalNO-SPAM
Patrick Stadelmann wrote:

y a t'il un moyen de changer cela ???


Il faut utiliser "set current item"


bon finalement, par l'intermédiaire de la liste
j'ai trouve une solution :

tell panelWindow
tell popup button "lang"
set its current menu item to its first menu item whose title
contains lang
end tell
end tell

mais pas par l'id de l'item...
--
yt