var f as FolderItem
if f <> Nil Then
var NewWindow As new MainWindow
NewWindow.LoadData(f)
End If
LoadData contains
if f <> nil then
var UserSelect As TextInputStream
UserSelect = TextInputStream.Open(f)
UserSelect.Encoding = Encodings.UTF8
var ReadData As String
ReadData = UserSelect.ReadAll()
var NewWindow As new MainWindow
// -------------- TITLE BOX ----------------
NewWindow.TitleBox_1.Text = ReadData.NthField("field_divider", 1)
NewWindow.TitleBox_2.Text = ReadData.NthField("field_divider", 2)
NewWindow.TitleBox_3.Text = ReadData.NthField("field_divider", 3)
// -------------- TEXT BOX ----------------
NewWindow.TextBox_1.Text = ReadData.NthField("field_divider", 4)
NewWindow.TextBox_2.Text = ReadData.NthField("field_divider", 5)
NewWindow.TextBox_3.Text = ReadData.NthField("field_divider", 6)
NewWindow.Title="Note++ - "+f.Name
NewWindow.NameFile = f
UserSelect.Close
end if
Thank you.
Can you now put that code into the Application.OpenDocument event instead of the Window’s Opening event ?
If you want the Window to display something when it is opened, either you need to ask the user for the file (using your original code), or go get a file which you know the location of.
You already have this answer in a previous entry (answer):
remove the line
Var ReadWindow As New MainWindow
Instead of asking question at each stage of your project developement, do your home work: read the tutorials, check the examples, read the Language Reference, read the “ Introduction to Xojo Programming Book” book.
You will not have to wait for answers that are… pure bet (guess).
Of course, if after doing your home work you have troubles, ask.
IMHO.
In my experience, memory works far more efficiency after searching vs getting an answer.
I guess MainWindow is your Default Window, you either change that to None or do not create a new window and use MainWindow (without the var NewWindow) and change your code to use MainWindow instead:
And with:
var NewWindow As New MainWindow
you are creating another window.
If you are going to create NewWindow based on MainWindow you may want to change the ‘Implicit Instance’ to False (you can review the docs about implicit instance):