gettingstarted
[Top] [All Lists]

Re: Reading in text from a file into a ListBox with 2 columns

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Reading in text from a file into a ListBox with 2 columns
From: Paul Young <youngpr at myactv dot net>
Date: Mon, 31 Jan 2005 09:10:54 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <BE231956 dot 1A1E7%pheycock at bellsouth dot net>
Phil, Michael and Emile,

Thanks very much for the suggestions. The problem was trying to call the method from App. Calling it from PlistClass events worked.

There is so much to learn. I will study all of your suggestions carefully.

Paul


On Jan 30, 2005, at 11:08 PM, Phil Heycock wrote:

Try calling 'getPlist' from the open event of 'PlistClass'.

P.
*********************************************
on 1/30/05 6:02 PM, Paul Young at youngpr at myactv dot net wrote:

Phil,

I titled the new Class as "PlistClass" and now it has four methods:
concatenateRow, getPlist, savePlist and writeToTextFile.  All are
declared Public access.

I need to call getPlist from App/Event/Open but the debugger tells me
getPlist does not exist, even though I use "PlistClass.getPlist" What
am I missing?

Thanks,

Paul


On Jan 29, 2005, at 10:32 PM, Phil Heycock wrote:

Hi, Paul,

Taking this a step further, consider making the 'write-to-file' a part
of
the custom ListBox class functionality, as well. Add another method:

Sub writeToTextFile(t As TextOutputStream)
    Dim row As Integer
    // Write the first row to file
    t.WriteLine concatenateRow(row) // row is zero (0) here
    // Write the remaining rows, if any... delimited
    For row = 1 To ListCount - 1
        t.WriteLine EndOfLine + concatenateRow(row)
    next
End Sub

Your PushButton.Action event would contain this code, calling a method
('saveListBox') in the Window:

Sub Action()
    If ListBox1.ListCount > 0 Then
        saveListBox
    Else
        Beep
        MsgBox "The ListBox is empty. Nothing to save."
    End If
End Sub

Sub saveListBox ()

    dim f as FolderItem = PreferencesFolder.Child("filename.plist")
    dim t as TextOutputStream = f.CreateTextFile

    If t <> nil Then
        ListBox1.writeToTextFile t
        t.close
    Else
        Beep
        MsgBox "File not opened. Nothing saved."
    End If

End Sub


Function contatenateRow(row As Integer) As String
    Dim col As Integer
    Dim rowTxt As String = Cell(row, col) // col is zero (0) here
    For col = 1 To ColumnCount - 1
        rowTxt = rowTxt + HT + Cell(row, col)
    Next
    Return rowTxt
End Function


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>