[Gambas-user] Gambas components: howto?

Benoit Minisini gambas at ...1...
Wed Dec 21 13:29:47 CET 2005


On Wednesday 21 December 2005 11:48, Marco Gusy wrote:
> Alle 15:05, martedì 20 dicembre 2005, Benoit Minisini ha scritto:
> > There is no documentation at the moment, because things are not
> > definitive. But you will see many examples of controls made in Gambas in
> > the gb.form component of the development version. The source code is in
> > the 'comp' directory of the source tree.
> >
> > Regards,
>
> Great! Thanks, i'm studying them.
> A new question: I would like to copy the behaviour of the gridview control.
> I mean when i reference to it as "gridview. " it points to gridview
> properties, but when I write "gridview[1,2]. " it points to a single cell.
> How can I emulate this?
>
> Thanks
>
> Marco
>

To use an object like an array, you must implement the _put and _get special 
methods:

Example:

' Sets the value of myObject[Index1, Index2]
PUBLIC SUB _put(Value AS String, Index1 AS Integer, Index2 AS Integer)

END

' Returns the value of myObject[Index1, Index2]
PUBLIC FUNCTION _get(Index1 AS Integer, Index2 AS Integer) AS String

END

The only difference between components written in C/C++ and those written in 
Gambas, except speed :-) is that you cannot write "virtual" classes in 
Gambas.

"Virtual" in the Gambas sense, not the C++ one. See the Lexicon in the new 
wiki for more information.

So if you just have to create and return true objects if you want to have the 
same behaviour than gridview[x,y].

Regards,

-- 
Benoit Minisini





More information about the User mailing list