[Gambas-user] Object.Class(Me).Name and class name cases occassionally don't match

Benoît Minisini gambas at ...1...
Wed Oct 31 14:02:11 CET 2012


Le 31/10/2012 06:04, Bruce a écrit :
> I have a library which contains classes to analyse horse trial times.
> These classes rely on some files which contain some static data about
> the various analyses, these files are all called AbcZyx.meta where
> AbcXyz is the name of the relevant class (note the mixed case in both).
> When the first instance of any of these classes is created, it reads
> that associated file and sets up the static data.
>
> Somehow lately a strange thing has happened, one of the classes when it
> loads has it's name converted to lower case.  All the others preserve
> the case of the class name.
>
> I've put the following trace into the early methods for some of the
> projects that use this library:
>    Dim wkclass As Class
>    For Each wkclass In Classes
>      If Not IsNull(wkclass.Parent) Then
>        If wkclass.Parent.Name = "BaseBO" Then Print wkclass.Name
>      Endif
>    Next
>
> and generally this is what I get vs the "real" class name:
> ClassNameloaded	ClassNamereal
> --------------- --------------
> TrialSpeeds	TrialSpeeds
> TrialSpeed1	TrialSpeed1
> TrialSpeed3	TrialSpeed3
> TrialSpeed2	TrialSpeed2
> TrackMap	TrackMap
> TrackAltMap	TrackAltMap
> Horse		Horse
> trackname	TrackName	<------????
> Jockey		Jockey
> Track		Track
>
> So all of them, except TrackName have the expected class name.
>
> and when it tries to load the file via
>    Dim sFilename as String
>    Dim hMetaFile as File
>    sFileName=Object.Class(Me).Name&".meta"
>    Try hMetafile = Open $templatepath &/ sFileName For Input
>    etc
> it fails, because of the case mismatching of the names.
>
> I have searched every file in the library project and all of the client
> projects and can not find any instance of the string "trackname".  I
> have cleaned, recompiled etc etc each of these projects and this fail
> still occurs.
>
> Is there something special about a class called "TrackName"?  It only
> ever happens for that class.
>
> Totally bewildered?
> Bruce
>

There must be an occurence of "trackname" in lower case somewhere in 
your source code. The name of the class is the first name encountered by 
the interpreter.

Regards,

-- 
Benoît Minisini




More information about the User mailing list