[Gambas-user] ComboBox source code?

Tobias Boege taboege at gmail.com
Tue Feb 5 21:12:37 CET 2019


On Tue, 05 Feb 2019, T Lee Davidson wrote:
> On 2/4/19 7:57 PM, Benoît Minisini wrote:
> > Le 05/02/2019 à 00:26, T Lee Davidson a écrit :
> > > Does anyone know where the source code for the ComboBox control is?
> > > All I can find is MyComboBox.class which does not appear to be the
> > > full code for that control.
> > > 
> > > 
> > > ___
> > > Lee
> > > 
> > 
> > ComboBox is a native control. The source code is in the toolkit library (Qt or GTK+) and in the component source code.
> > 
> > Regards,
> > 
> 
> I found no ComboBox file in gambas/tree/master/gb.qt4/src nor in /gambas/tree/master/comp/src/gb.gui.base.
> 
> After searching through 251 of 367 blobs for "combobox", I discovered that
> ComboBox is defined, at least in part, in CTextBox.cpp. Unfortunately for
> me, that's not something I would have intuitively known.
> 
> I still did not find any code for ComboBox in /gambas/tree/master/comp, nor even for TextBox, after going through all 367 blobs.
> 
> I did, however, find confirmation of my suspicion in
> comp/src/gb.report/.src/Preview/FOptions.class. I can now correct the Wiki
> with the confidence that I won't be misleading people with false
> information.
> 
> Thanks. My question has been answered.
> 

Regardless of that, what you want to do when searching for a native class
is grepping for its declaration in the C/C++ "macro language" that Gambas
uses to define classes:

  [~/src/gambas/gb.qt4/src] $ grep "GB_DECLARE.*ComboBox" -nR *
  CTextBox.cpp:903:   GB_DECLARE(".ComboBox.Item", 0), GB_VIRTUAL_CLASS(),
  CTextBox.cpp:913:   GB_DECLARE("ComboBox", sizeof(CCOMBOBOX)), GB_INHERITS("Control"),

Once you've located the structure that contains the relevant GB_DECLARE,
you will see all its symbols (except the inherited ones) listed below the
class name declaration, together with the functions which implement them.
Of course, knowledge of the internals is required to proceed.

Needless to say, nobody would expect you to know that, so I'm relaying
the information here. There really isn't good up-to-date information about
hacking the native parts of Gambas, anyway.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list