Notifications
Clear all

[Closed] issue working with an array made of dotnet Button

I have this array that I keep expanding and shrinking as I need ( well it’s still not shriking but I’m hoping to)

I use this array to change the color of the button


test = #(dotNetControl:Headbutton:System.Windows.Forms.Button, dotNetControl:Neckbutton:System.Windows.Forms.Button)

My main issue is that I struggle to get the index of the button how can I retrieve it?
I tried store them as string but then I was unable to change the color using execute

THe array is build using this line:


appendIfUnique test (Selector.Headbutton)

Selector = the rollout and headbutton is the button that I add into the array

Is there a way to find the HeadButton or NeckButton in the test array?

2 Replies

nvm I managed to build an execute line using the button name stored as string
Is there another way to do this without using the execute command?

a = #(Selector.headbtn, Selector.neckbtn)
     finditem a Selector.neckbtn
 returns 2;
a = #()
    
    Rollout Selector "Selector"
    (
    	dotNetControl headbtn "Button" text:"head" height:22
    	dotNetControl neckbtn "Button" text:"neck" height:22
    	
    	on Selector open do
    	(
    		appendifunique a Selector.headbtn	
    		appendifunique a Selector.neckbtn
    	)	
    
    	on headbtn MouseDown args do ( print (finditem a Selector.headbtn)	)
    	on neckbtn MouseDown args do ( print (finditem a Selector.neckbtn)	)
    )
    createDialog Selector width:150

or even

a = #()
  
  Rollout Selector "Selector"
  (
      dotNetControl headbtn "Button" text:"head" height:22
      dotNetControl neckbtn "Button" text:"neck" height:22
      
      on Selector open do
      (
          appendifunique a headbtn    
          appendifunique a neckbtn
      )    
  
      on headbtn MouseDown args do ( print (finditem a headbtn)    )
      on neckbtn MouseDown args do ( print (finditem a neckbtn)    )
  )
  createDialog Selector width:150

then from outside the dialog

finditem a Selector.headbtn