Le 03/03/2014 20:49, Matti a écrit : > I'm playing around with a ComboBox that should have some special features. > Looked into the sources and found out how to create and inherit it. > Subs, Functions and Events work. > > But one thing is a complete riddle to me: > In the wiki, it says: "For example, you can create a custom MyListBox class > that inherits ListBox <http://gambasdoc.org/help/comp/gb.qt/listbox?view> but > allows to associate a tag with each list item." > That's exactly what I'd need for MyComboBox: each list item with a tag (ID > from a database). > > Could someone give me a hint how to do that? > Thanks, Matti >
If you create a class named ComboBox in your project, and if you export that class, it will extend the native ComboBox class located in the GUI component. That way, by redefining the Add(), Clear(), _get()... methods (i.e. every method that read or write a ComboBox list element), and by using the SUPER keyword to call the methods of the overriden class when needed, you can add support for an item index associated with the item text. If you want to keep the original ComboBox class, just use another name, but then add "Inherits ComboBox" to that class. Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user