I think this is my problem
3.4. Inheritance and constructor Contrary to all the object language I know, each class in the inheritance hierarchy consumes the parameters passed to the constructor. Let's suppose we have the following inheritance tree: |MyListBox ---inherits--> ListBox ---inherits---> Control | * Control <http://gambaswiki.org/wiki/comp/gb.gtk/control>._new() does not exist. * ListBox <http://gambaswiki.org/wiki/comp/gb.qt4/listbox>._new() takes one parameter: the parent control. * MyListBox._new() takes one parameter: a name - It is just an example. So |NEW <http://gambaswiki.org/wiki/lang/new> MyListBox| will take two parameters. * The first will be sent to ListBox <http://gambaswiki.org/wiki/comp/gb.qt4/listbox>._new(). * The second to MyListBox._new(). Be careful: the ListBox <http://gambaswiki.org/wiki/comp/gb.qt4/listbox>._new() will be called first, so that you are sure that the ListBox <http://gambaswiki.org/wiki/comp/gb.qt4/listbox> control exists when you are in MyListBox._new(). Then you will create a MyListBox control this way: hMyListBox *=* *New* *MyListBox**(*hContainer*,* "Name"*)* So the order of arguments is the following: * Mandatory arguments are consumed first, and then optional arguments if they are available. * The arguments of elder classes are specified first. In Gambas 2.0, the order or arguments were reversed! For example, if you have the following inheritance: |MyForm --> Form --> Window | with the MyForm constructor being: |Sub _new(FirstArg As String, SecondArg as Integer, Optional ThirdArg As Integer) | Note: the Form <http://gambaswiki.org/wiki/comp/gb.qt4/form> constructor takes no argument, and the Window <http://gambaswiki.org/wiki/comp/gb.qt4/window> constructor takes an optional parent argument. The signature of the final constructor will be: |New MyForm(FirstArg As String, SecondArg As Integer, Optional Parent As Control, Optional ThirdArg As Integer) | In a more general way, the order of arguments for a three level inheritance tree is: * Mandatory arguments of the grand-parent constructor. * Mandatory arguments of the parent constructor. * Mandatory arguments of the final constructor. * Optional arguments of the grand-parent constructor. * Optional arguments of the parent constructor. * Optional arguments of the final constructor. On 17/02/17 13:55, Benoît Minisini wrote: > Le 17/02/2017 à 03:08, Shane a écrit : >> Looks Like Pic1 >> >> and then pic2 >> >> >> > Which version of Gambas do you use? > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user