First, the int parameter passed to our handler by GLUI represents the id of the control element. Although it is required as a parameter, we are not using it in our handler.

Note from our discussion on the creation of the browser element, we create a pointer to the browser class element, which we store in the global variable fileBrowser. In turn, we obtain the filename (string) selected by the user with a call to the class function
get_file()
Since we cannot set a filter for our browser element, any file within the directory appears in the list box and can be selected by the user. Thus, we must do the "filtering" within our handler and accept only filenames that have the extension "obj".

We proceed with such filenames by creating a pointer to an instance of the class ObjModel. The class constructor requires the complete pathname to the directory holding the obj file and the name of the file. The directory pathname is established in our function SetPaths (see the discussion on this function). The directory pathname is required as a separate string since the ObjModel class needs to locate and read from this directory the associated material file (.mtl file). Once we have created the pointer, which we call model, we pass it onto our instance of CGWorld with the call
cgWorld.setModel(model)