New topic: 

problem with Save and or Open

<http://forums.realsoftware.com/viewtopic.php?t=31461>

       Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic         Author  
Message       Realgeekaye           Post subject: problem with Save and or 
OpenPosted: Mon Dec 07, 2009 8:12 pm                        
Joined: Mon Dec 07, 2009 12:49 am
Posts: 3              The beginner is back!
I tried using the menuhandler to save a text file.  But when I try to open the 
file using an Open menuhandler the file is dimmed so am unable to open it.  I 
checked the date in the text file and it is written as I would expect.  Here 
are the two routines I wrote in the menuhandlers.

  Dim file As FolderItem, totRows, row, k as integer
  Dim fileStream As TextOutputStream
  file=GetSaveFolderItem("text","MatchUpData")
  If file<> Nil Then
  fileStream=file.CreateTextFile
  totRows=ListGirls.ListCount
  for row = 0 to totRows-1
  for k=0 to 57
    fileStream.WriteLine ListGirls.cell(row,k)
  next k
  next row
  totRows=ListBoys.ListCount
  for row = 0 to totRows-1
  for k=0 to 57
    fileStream.WriteLine ListBoys.cell(row,k)
  next k
  next row
  fileStream.Close
  end if
  
  Return True
  
and

  Dim f as FolderItem, k as integer,data as string
  Dim stream as TextInputStream
  dim tot as integer
  
  f=GetOpenFolderItem("text")
  If f <> Nil then
  stream = f.OpenAsTextFile
  While Not stream.EOF
  data = " "
  ListGirls.InsertRow 0,data
  for k=0 to 57
    ListGirls.cell(0,k)=stream.ReadLine
  next k
  data = " "
  ListBoys.InsertRow 0,data
  for k=0 to 57
    ListBoys.cell(0,k)=stream.ReadLine
  next k
  Wend
  stream.Close
  tot=ListBoys.ListCount
  TextFieldTotBoys.text=str(tot)
  tot=ListGirls.ListCount
  TextFieldTotGirls.text=str(tot)
  End if
  
  Return True   
                            Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to