DONE: Examples

Please report bugs.

DONE: Examples

Postby Henning » Sun Dec 05, 2010 11:02 pm

Hi Bernd,

It would be easier to understand Array Type if the example did compile...

It seems that .Count(), .Insert() and .Replace are unrecognized.
Code: Select all
' this is the global scope
Signal on_ProjectOpen()
 
 Dim a As Array = Array(1, 2, "Hello", "World")
 Dim s As Integer
 
 MsgBox("Array Example")
' MsgBox(a.Count()) 
 a.RemoveAll()
' MsgBox(a.Count())
 a.Append("super")   
 MsgBox(a)
 a.Remove(0)
' a.Insert("Sunday", 0) 
 MsgBox(a.Object(0))
' a.Replace("Monday", 0)
 MsgBox(a)

  Dim ab As Array = Array(Array("Hello", "World", False), Array(99.99, 66, True))   
 
'  WriteArray(ab, Desktop.DesktopLocation() & "/arraytest.xml")
'  ab = ReadArray(Desktop.DesktopLocation() & "/arraytest.xml")
  MsgBox(ab)
 


End Signal

Event Init()
  Timer(1, on_ProjectOpen) ' workaround for delayed init for global ' TODO2
End Event


After commenting out the lines abowe, I get:
Start Q7Basic compiler...
Read source files...
Compile Global.QObject
Compile MainWindow.QMainWindow
Compile MainWindow.QMainWindow_disabled
Compile SystemTray.QSystemTrayIcon


:= expected in line 30 in file Global.QObject
...) ' workaround for delayed init for global ' TODO2
End Event


/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: DONE: Examples

Postby berndnoetscher » Thu Mar 10, 2011 11:32 am

Hi Henning

Your code needed to use the correct methods. Also the arguments order weren't correct.

I will add alias for Length->Count SetObject->Replace.

Code: Select all

    Dim a As Array = Array(1, 2, "Hello", "World")
    Dim s As Integer

    MsgBox("Array Example")
    MsgBox(a.Length())
    a.RemoveAll()
    MsgBox(a.Length())
    a.Append("super")   
    MsgBox(a)
    a.Remove(0)
    a.Insert(0, "Sunday")
    MsgBox(a.Object(0))
    a.SetObject(0, "Monday")
    MsgBox(a)

    Dim ab As Array = Array(Array("Hello", "World", False), Array(99.99, 66, True))   

  '  WriteArray(ab, Desktop.DesktopLocation() & "/arraytest.xml")
  '  ab = ReadArray(Desktop.DesktopLocation() & "/arraytest.xml")
    MsgBox(ab)
berndnoetscher
Site Admin
 
Posts: 344
Joined: Thu Mar 25, 2010 9:57 am


Return to Bug Reports

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron