Am Dienstag, den 19.01.2010, 17:30 -0700 schrieb Dimitris Anogiatis:
> Hey Charlie,
> 
> Try changing this line
> 
>      sKey = col1.Key
> 
> to
> 
>      sKey = sElem.Key
> 
> 
> Hope this helps
> 
> Regards,
> Dimitris
> 
> On Tue, Jan 19, 2010 at 4:09 PM, Charlie Reinl <karl.re...@fen-net.de>wrote:
> 
> > Salut Benoit,
> >
> > its about Collection KEY and Debug-Window on gambas2.
> >
> > If you run that project, and open col1 and col2 in a Debug-Window
> > (DBl-Click on the var), the Collection Key is always the last enumerated
> > element.
> >
> > If you run it without Debug-Window or only col2 in a Debug-Window , the
> > Collection Key is the last read.
> >
> > PUBLIC SUB Main()
> > DIM col1 AS NEW Collection
> > DIM col2 AS NEW Collection
> > DIM sElem AS String
> > DIM sKey AS String
> >  col1.Add("1", "one")
> >  col1.Add("2", "two")
> >  col1.Add("3", "three")
> >  col1.Add("4", "four")
> >  PRINT "Returns the key of the last read or last enumerated element. "
> >   FOR EACH sElem IN col1
> >      sKey = col1.Key
> >      PRINT sKey & " = " & sElem
> >      col2.Add(sElem, sKey)
> >   NEXT
> > END
> >
> > see attached project.
> > --
> > Amicalement
> > Charlie
> >
> > [OperatingSystem]
> > OperatingSystem=Linux
> > KernelRelease=2.6.24-26-generic
> > DistributionVendor=ubuntu
> > DistributionRelease="Ubuntu 8.04.3 LTS"
> >
> > [System]
> > CPUArchitecture=i686
> > TotalRam=506932 kB
> >
> > [Gambas]
> > Gambas1=gbx-1.0.17
> > Gambas1Path=/usr/bin/gbx
> >
> > Gambas2=2.19.0                  rev.2613
> > Gambas2Path=/usr/local/bin/gbx2
> >
> > Gambas3=2.99.0                  rev.2602 (can't compile actually)
> > Gambas3Path=/usr/local/bin/gbx3
> >
> >

Salut Dimitris,

no can't work like that , sElem is 'only' a String.

It is like written in the doc, 
"Returns the key of the last read or last enumerated element."
The  problem is, I think, that the Debug-Window loops the collection,
(every time I move in the collection), to refresh all members, so when I
try to set the 'sKey = col1.Key' the last element was read and its KEY
returned. 
The Watch-Window shows the right value. But also the col1 collection in
the Watch-Window 'derange' to find the right col1.key

  
-- 
Cordialement
Charlie


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to