First of all, thanks for your time and dedication!!!! Basically, I'm not too oriented to OOP because....I'm not a programmer, I'm just an economist. It's only a hobby.
But the most important thing to not moving to oop, or not moving successfully, is that I started programming in basic, some scriping lenguajes, PHP...and so on. So I'm not too familiarized with oop, and I couldn't find a good manual about it (I'm sure it exists), adding that gambas documentation is very poor. BTW, your code is excelent, and shows in a clear way the benefits of OOP. So I will take the code as start point, and I'll try to improve my oop with gambas. So I will ask many questions on the list...so be patient, please!!!! Regards, Mato.- 2010/8/8 Caveat <[email protected]> > Hello again Mato > > I don't really get this code. Why do you set xml8tracks to new > XMLReader, then immediately set it to the return from urlDownload? > > Where is urlDownload defined? What does it return? Where do you define > xml8tracks? What is smix? Why is smix defined as String [10, 4]? Is > that something you know upfront? In the "name" case, your debug could > be confusing as you print that you're showing smix[id, 0] but you > actually show smix[0, 0]. > > Please send us enough of the code that we can see what's going on and > help a little more... > > My first tentative thought is that the odd, seemingly contradictory > message "I wanted an Array but I got an Array" could be complaining > because it's expecting one type of Array but getting another (so looking > for a one-dimensional String Array but getting a 2-D one, or looking > forRegards,classes a String Array but getting a kind of Variant one or > so... ). > > But all that aside... I think that you need to start thinking in a more > object-oriented way, so I've started you off with the changes to > TestProject3 (see attached) to make it more oo. You'll notice I've > added 3 classes, Response, MixUser, and Mix. The Response class holds a > Collection of Mixes, the Mix class has a MixUser ... look at the > procedure UseClasses on the Form to start to get an idea of how you'd > need to use the classes. > > Create a new instance of the Response class when you get your XML, as > you go through the XML and hit a new mix, create a new Mix object, when > you get to a User, create a new MixUser object... when you hit the end > of a Mix object, add that to the Response object... etc. etc. > > Sorry, I really have to go... let me know if you're still stuck!! > > Regards, > Caveat > > > On Sat, 2010-08-07 at 13:25 -0300, Matías Manuel Grandi wrote: > > Sorry, hi goes again!!! > > ----------------------------------------------------------------- > > > > Hi Guys!w > > I have a problem when calling a function, which receive an xmlreader > > and returns an array. > > The function is geturl and the error gambas give me is "Type Mismatch: > > Wanted an Array, got an Array instead" > > The code is (a bit simplified): > > > > PUBLIC SUB btnPopular_Click() > > DIM GetUrlFromXml AS Array > > xml8tracks = NEW XmlReader > > xml8tracks = urlDownload("http://8tracks.com/mixes.xml?sort=popular") > > GetUrlFromXml = GetUrl(xml8tracks) > > END > > > > PUBLIC FUNCTION GetUrl(reader AS XmlReader) AS Array > > DIM smix[10, 4] AS String > > DIM id AS Integer > > > > DO WHILE TRUE > > TRY reader.Read() > > IF reader.Eof THEN BREAK > > IF reader.Node.Type = XmlReaderNodeType.Element THEN > > SELECT CASE reader.Node.Name > > CASE "name" > > id = id + 1 > > reader.Read() > > smix[id, 0] = reader.Node.Value > > PRINT id & "Nombre: " & smix[0, 0] > > CASE "restful-url" > > reader.Read() > > smix[id, 1] = reader.Node.Value > > PRINT id & "restful-url: " & smix[id, 1] > > END SELECT > > ENDIF > > LOOP > > reader.Close() > > IF ERROR THEN > > Message.Error("Error when trying to open the Heroes.XML file!") > > RETURN > > ENDIF > > RETURN smix > > END > > > > Thanks! > > Mato.- > > > > > > 2010/8/7 M. Cs. <[email protected]> > > > > > > It's not readable! Can you resend it without weblinks? > > > > ------------------------------------------------------------------------------ > > > This SF.net email is sponsored by > > > > > > Make an app they can't live without > > > Enter the BlackBerry Developer Challenge > > > http://p.sf.net/sfu/RIM-dev2dev > > > _______________________________________________ > > > Gambas-user mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by > > > > Make an app they can't live without > > Enter the BlackBerry Developer Challenge > > http://p.sf.net/sfu/RIM-dev2dev > > _______________________________________________ > > Gambas-user mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Gambas-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gambas-user > > ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
