On Tue, 31 Jul 2012, Beno?t Minisini wrote:
> Le 30/07/2012 21:12, Tobias Boege a ?crit :
> > Hi,
> >
> > Hans ran this function from me on his setup (don't know which revision) with
> > the following parameters "ToolTip" and "Tooltip". Note the second 't' in
> > lowercase. The first gave a lot of class names, the second argument only
> > gave the "Action" class. Could this be a typo?
> >
> > Alas, below is a test version I just wrote to test this potential bug on
> > my system of choice where no graphical components are compiled so I cannot
> > test :-/ If somebody could quickly run this test in a graphical project
> > where the classes in question are present, I could report the results back
> > to Hans (if he just has to update his revision or check other things
> > instead).
> > If I remember correctly, the documentation is generated from the gambas
> > sources and thus it could be reliable enough to check for typos, right? I
> > cannot see any in the gb.qt4 component but Hans just re-reported this issue
> > to me...?
> >
> > Here goes the code:
> >
> > Public Sub Main()
> >
> >    Print "ToolTip:"
> >    Print "", SearchClasses("ToolTip").Join("\n\t")
> >    Print
> >    Print "Tooltip:"
> >    Print "", SearchClasses("Tooltip").Join("\n\t")
> >    Print
> >
> > End
> >
> > Private Function SearchClasses(sProp As String) As String[]
> >
> >    Dim hClass As Class
> >    Dim aNames As New String[]
> >
> >    For Each hClass In Classes
> >      If hClass.Symbols.Exist(sProp) Then aNames.Add(hClass.Name)
> >    Next
> >    Return aNames
> >
> > End
> >
> > Regards,
> > Tobi
> >
> 
> There is a typo indeed. But what is the problem with it, as symbols are 
> case unsensitive?
> 
> -- 
> Beno?t Minisini
> 

I don't know what he wanted to accomplish and if this is necessary but if
the above code lists 'Action' in a different group of spelling 'ToolTip'
(and it really does), property names are _not always_ case insensitive,
right? I myself find that somewhat inconsistent.
I'll ask him for his specific need for that trick if you want but I don't
think this problem will be encountered in every-day code...
I cannot see any feasible solution here - the whole property lookup process
from classes is certainly case insensitive but the operations on the
Class.Symbols which is String[] cannot simply be intercepted and
automatically made gb.IgnoreCase, or am I wrong?

Alternatively, I'll just tell him that we cannot assume any case in any
names when using the Object and Class interfaces so that we always manually
set gb.IgnoreCase on these.

Regards,
Tobi

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to