Getting button ID from flowlayoutpanel

Hi,

I have a flowlayoutpanel which is populated with image buttons from an array. Is it possible to access some sort of 'button id' when it is clicked, that corresponds to it's place in the array?

Further info:
This wasn't a problem at first because all my jpgs were in the same directory so I could grab the ctrl.text and identify the file I wanted from that. However my script now implements a getFilesRecursive function and I can't tell where each button/file comes from, but the array would tell me this.

Cheers,
Alex

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alexcfarrell's picture

Cheers

Perfect! I saw the tag property, and was unsure how it was used.

Thanks for your help,
Alex

barigazy's picture

...

In .net tag property you can put anything (variables, arrays, values, controls etc.) Probably you noticed that event fn's not allow local variables. Using tag's is one way to solve that problem. Read also this mxsHelp topic about dotNetMxsValue

bga

barigazy's picture

...

Hey Alex,
set Tag property of image buttons to be flowlayoutpanel which containes theses imgButtons.
Examle :
--------------------------------------
flp = flowlayoutpanel
imgBtn = image Button
imgBtn.Tag = flp
Now you can assigne event to the img buttons

dotnet.AddEventHandler imgBtn "MouseUp" (fn printIndex s e = print (s.Tag.controls.IndexOf s)) 

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.