[Gambas-user] Enumerate all classes inheriting X
zainudin ahmad
author.ilmi at ...626...
Sat Nov 7 07:36:14 CET 2015
May be this code can help.
Public Sub Main()
Dim sClass As String
Print "Count : " & Dir(".gambas").Count & "\n"
For Each sClass In Dir(".gambas")
Print sClass;
Try Print "-->" & Object.Class(Object.New(sClass)).Parent.Name '<--
this make class load into memory
If Error Then Print
Next
End
On Fri, Nov 6, 2015 at 12:04 PM, Tobias Boege <taboege at ...626...> wrote:
> Hi,
>
> in my project I have the need to enumerate all classes from my current
> project (not from components) for which
>
> hClass Is X
>
> is true for some fixed class X, once at startup. I think I tried
>
> For Each hClass In Classes
> hCurrent = hClass
> While hCurrent.Parent
> If hCurrent.Parent = Classes["X"] Then
> aRes.Add(hClass)
> Break
> Endif
> hCurrent = hCurrent.Parent
> Wend
> Next
>
> (written from memory, but it gets the idea across). However, this does not
> work as Classes can only access the already loaded classes.
>
> Is there a way to enumerate _all_ classes in the current project or to
> force
> loading of all remaining classes from the project? I have no particular
> technical problem with hard-coding the desired list instead of computing it
> but I want to know if I *could* compute it.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list