ScriptSpot

Forum topic · General Scripting

Iterate through GUI elements

By docJones · 2014-09-17

Description

hey there,

anybody knows if this is possible?:

I got 4 Buttons (for example):

rollout rollThumbs "Thumbnails"
(
button start "GO!" height: 150 width: 150 across:2
button ImageButton1 "" height: 150 width: 150 across:2
button ImageButton2 "" height: 150 width: 150
button ImageButton3 "" height: 150 width: 150 across:2
button ImageButton4 "" height: 150 width: 150

on start pressed do
(
for i = 1 to xxx;
do
(
rollThumbs.imageButton+(i As String).images = #(openBitmap xxx...)
)

so I can asign images to those 4 Buttons in the for looop without picking them
each by itself!?

greetings

Comments (2)

barigazy · 2014-09-17


try(destroyDialog ::rollThumbs)catch()
rollout rollThumbs "Thumbnails"
(
button start "GO!" height:20 width:50 pos:[5,5]
button ImageButton1 "" height: 50 width: 50 pos:[5,30] border:off
button ImageButton2 "" height: 50 width: 50 pos:[5,85] border:off
button ImageButton3 "" height: 50 width: 50 pos:[5,140] border:off
button ImageButton4 "" height: 50 width: 50 pos:[5,195] border:off
on start pressed do
(
for c in rollThumbs.controls where c.name != "start" do
(
bmp = (bitmap 50 50 color:(random black white))
c.images = #(bmp, undefined, 1,1,1,1,1 )
)
)
)
createdialog rollThumbs 60 250 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

docJones · 2014-09-19

hey,

it works! Thx :)