Changing the window
Change your window part so that it contains a list instead of the push button.
Note:
Deleting the push button removes your event-to-script connections.
Changing the script
Modify your openFile script to remove the logic for the file dialog, because the selectedItem attribute of the list will give us the file name instead. The script should look like the following:
openFile
"Opens a file and reads its contents"
| file fileStream text |
file := (self subpartNamed: 'List1') selectedItem.
(file == nil)
ifFalse: [ fileStream := CfsReadFileStream open: file.
text := (fileStream upToEnd) trimSeparators.
fileStream close.].
(self subpartNamed: 'Multi-line Edit1') object: text.
Create an event-to-script connection that connects the defaultActionRequested event of the list part to your new openFile script.
Last modified date: 07/01/2020