[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class[Symbol] question



On 21/9/24 3:58 am, Benoît Minisini wrote:
Le 20/09/2024 à 20:19, BB a écrit :

On 21/9/24 1:52 am, Benoît Minisini wrote:
Le 20/09/2024 à 18:07, BB a écrit :
Is there a way to tell at runtime whether a class symbol is inherited?

tia

b



By looking in the parent class if you find the same symbol.

What for?

I've got a complex project underway and it has a fairly complex set of classes that inherit from several layers of parents. I am trying to put a grid in the "common" display form showing all the properties of the current class and the values of the current object. I just want to test if a property is inherited or not and if not then that row is formatted bold. A bit like how the Help Browser does it.

Why at runtime? Because I am having a hard time of it finding properties that are not being displayed (or not in the right place) and it would be easier if I could see the local properties highlighted.

It sounds like a lot but the properties gridview is working fine and all the properties of the class are displayed. Its just that highlighting that is avoiding me.

To expand your answer a little bit, I think that I need to load all the parent classes properties up the chain when I start to load the grid and then for each property in "this class" I could just check that list for the property name? Or would it be faster to check the Object.Class(thisclass.Name).Parent each time?

How (in simple terms) does the help browser do it? I've tried wading through the IDE code but just can't find it.

thanks

b



The IDE uses an internal representation of the component metadata stored in the '*.info' an '*.list' files in '/usr/share/gambas3/info'.

But as you are interested in classes already loaded, it's faster to look at them directly.

And to know if a class symbol comes from its parent, I look in the parent as I told you.

If a class is loaded, all its parent are necessarily loaded too.

Regards,

A big thankyou Benoit!

Wasn't that hard after all - if you know what you are doing 😁

regards

b

Attachment: grid.png
Description: PNG image


References:
Class[Symbol] questionBB <adamnt42@xxxxxxxxx>
Re: Class[Symbol] questionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Class[Symbol] questionBB <adamnt42@xxxxxxxxx>
Re: Class[Symbol] questionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>