You are not logged in.

wolwer

Beginner

  • "wolwer" started this thread

Posts: 3

Date of registration: Nov 26th 2008

  • Send private message

1

Wednesday, November 26th 2008, 3:28pm

Öffnen und lesen von Dateien

Hallo,
erst einmal ein ganz dickes Lob für das Programm.
Zwei (kleine) Fragen :
1. Wie öffne und schliesse ich eine Datei zum Lesen und / oder Schreiben ?
2. Wie ist die Syntax für das Listview-Controll, hier insbesondere das 'add' von 'childs'
Danke im voraus
Wolfgang

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

2

Wednesday, November 26th 2008, 4:05pm

> 1. Wie öffne und schliesse ich eine Datei zum Lesen und / oder Schreiben ?

Dafür gibt es 2 Möglichkeiten:

BASIC-like

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
Public Sub Command1_Click()
Dim myFile As VBFileHandler
   ' write
   myFile = Open("C:\test.txt", Random, ReadAndWrite, Shared)
   Call write(myFile, "testtesttest")
   Call Close(myFile)
   'read
   myFile = Open("C:\test.txt", Random, ReadAndWrite, Shared)
   MsgBox readline(myFile)
   Call Close(myFile)
End Sub



Java-like (Lesson: Basic I/O)

Jabaco Source

1
2
3
4
5
6
7
8
9
10
Public Sub Command1_Click()
' write
   Dim outputStream As New java#io#BufferedWriter(New java#io#FileWriter("c:\test.txt"))
   outputStream.write "abcdabcdabcd"
   Call outputStream.close()
   ' read
   Dim inputStream As New java#io#BufferedReader(New java#io#FileReader("c:\test.txt"))
   MsgBox cStr(inputStream)
   Call inputStream.close()
End Sub


> Wie ist die Syntax für das Listview-Controll, hier insbesondere das 'add' von 'childs'

Die ListBox? Genau wie in Visual Basic:

Jabaco Source

1
2
3
4
5
Public Sub Command1_Click()
   List1.AddItem "add item at the end" 
   List1.AddItem "add top-item", 0
   List1.AddItem "add middle", 1
End Sub


nur mit vielen coolen Extras:

Jabaco Source

1
2
3
4
Public Sub Command1_Click()
   List1.AddItem New ListCellData("add item with icon", ConsoleGif)
   List1.AddItem New UsercontrolXYZ()
End Sub

Peter

Trainee

  • "Peter" is male

Posts: 69

Date of registration: Nov 24th 2008

Location: Cologne, Germany

Occupation: Second Vice President of Distributed Junk and Trash Development

  • Send private message

3

Wednesday, November 26th 2008, 4:38pm

List1.AddItem New UsercontrolXYZ()

Whow! Das ist ja mal cool! :thumbup:

Grüße ... Peter

wolwer

Beginner

  • "wolwer" started this thread

Posts: 3

Date of registration: Nov 26th 2008

  • Send private message

4

Wednesday, November 26th 2008, 7:48pm

Danke

Danke für die SUPERSCHNELLE Antwort.
Ich denke, ich werde mich mal eingehender mit diesem wirklich guten Programm beschäftigen.

wolwer

Beginner

  • "wolwer" started this thread

Posts: 3

Date of registration: Nov 26th 2008

  • Send private message

5

Wednesday, November 26th 2008, 7:51pm

Nachtrag

Ich meinte übrigens nicht die Listbox sondern das Treeview-Control.
Daher auch die Frage nach dem 'Child'-Objekten.

Peter

Trainee

  • "Peter" is male

Posts: 69

Date of registration: Nov 24th 2008

Location: Cologne, Germany

Occupation: Second Vice President of Distributed Junk and Trash Development

  • Send private message

6

Wednesday, November 26th 2008, 8:31pm

Ich meinte übrigens nicht die Listbox sondern das Treeview-Control.
Daher auch die Frage nach dem 'Child'-Objekten.


So kann man Nodes einem TreeView hinzufügen:

Jabaco Source

1
2
3
Dim RootNode As Node = Tree1.Nodes.Add(Nothing, tvwFirst, "Root", "Root")
Dim ChildNodeFromRoot As Node = Tree1.Nodes.Add(RootNode, tvwChild, "ChildFromRoot", "ChildFromRoot")
RootNode.Expand = True


Grüße ... Peter

(Manuel wird gleich wahrscheinlich wieder eine viel coolere Java-like - Methode posten ;))

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

7

Wednesday, November 26th 2008, 8:35pm

auch treeview in jabaco ist treeview in visual basic sehr ähnlich:

Jabaco Source

1
2
3
4
5
6
7
Public Sub Command1_Click()
   Dim Root As Node
   Root = Tree1.Nodes.Add(Nothing, tvwFirst, "Root", "Root")
   Tree1.Nodes.Add Root, tvwChild, "Child1", "ChildItem"
   Tree1.Nodes.Add Root, tvwChild, "Child2", "Child with icon", DialogGif
   Root.Expand = True
End Sub

Rate this thread
WoltLab Burning Board