Use controlP5 listBox to select string

I am looking at an example from the older forum. I am using version 3.5.3. I can get this sample to work, partially, by commenting out the two lines with “theEvent.group().value()” which give the error “The function value() does not exist.”
Perhaps I am missing a library.

import controlP5.*;
ControlP5 controlP5;

// add an int variable which will store the
// id of the latest selected listbox item.
int myCurrentIndex = 0;
// make the list of tokens global, then it is
// accessible in both setup and draw 
String[] tokens;


void setup( ) {
  size(470, 295);

  controlP5 = new ControlP5(this);
  ListBox l = controlP5.addListBox("myList",20,40,80,200);

  // creating an arbitrary String array, add values
  // to the array and add new items to the listbox 
  // at the same time. value of each item added to the listbox 
  // corresponds to the token in the string array 'tokens'.
  tokens  = new String[1000];
  for (int k = 0; k < tokens.length; k++){
    tokens[k] = k+"-item";
    l.addItem(tokens[k], k);
  }
}

void controlEvent(ControlEvent theEvent) {
  if (theEvent.isGroup()) {
    // an event from a group e.g. scrollList
      println(theEvent.group().value() +" from "+theEvent.group());
      // controlEvent is called when a listbox-item
      // has been activated, hence update the value
      // of myCurrentIndex accordingly
      myCurrentIndex = int(theEvent.group().value());
    }
}

void draw(){
  background(0);
  fill(255);
  // display and draw a token as text
  text(tokens[myCurrentIndex],200,40);
}

sorry, but did you see in the example ListBox following info?

// ListBox is DEPRECATED,
// use ScrollableList instead,

I checked the examples and this is what I found about groups. I do not have the info or docs to describe the proper way to setup groups. However, the following did the trick:

void controlEvent(ControlEvent theEvent) {  
    myCurrentIndex = int(theEvent.getValue());
    println("Watch: " + myCurrentIndex);
}

Kf

Thanks. Both responses worked. group() is also depricated.