Multi FXDataTarget

Hello There
I’m trying to create a window that will display a line similar to what
datatarget.rb exemple does, except it would do it for an unknown number
of items, stocked in a given array.

Here is the code I would like to use except it doesn’t work:

#@repartition is a hash {string => [int,int]}
#tech is the array of items & item.name is one of the keys of
@repartition

@sum_current=FXDataTarget.new(0)

@current_techname=FXDataTarget.new("")

@sum_current.connect(SEL_CHANGED){
@sum=@sum_current.value
}

@repartition.each{|key,val|
@sum_current.value=@sum_current.value+val[1]
}

datas=[]
k=0

tech.each{|t|

  FXLabel.new(mtrix,"#{t.name}:")

  @repartition["#{t.name}"][0]=1

  datas.push(FXDataTarget.new(@repartition["#{t.name}"][1]))

  datas[k]

  datas[k].connect(SEL_CHANGED){

     @sum_current.value=@sum_current.value-@repartition["#{t.name}"][1]+datas[k].value
     @sum=@sum_current.value
     @repartition["#{t.name}"][1]= datas[k].value
  }

  FXSlider.new(mtrix, datas[k], FXDataTarget::ID_VALUE,
  LAYOUT_CENTER_Y|LAYOUT_FILL_ROW|LAYOUT_FIX_WIDTH, :width => 100)

  FXSpinner.new(mtrix,5, datas[k], FXDataTarget::ID_VALUE,
  SPIN_CYCLIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_CENTER_Y|LAYOUT_FILL_ROW)

  FXProgressBar.new(mtrix, datas[k], FXDataTarget::ID_VALUE,
  (LAYOUT_CENTER_Y|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK|
  PROGRESSBAR_PERCENTAGE|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW))


k+=1

}

Thanks a lot for the time you will spend on this

EDIT: I tried to redefine a @data=FXDataTarget for each item, but this
way the messaging is all messed up…