|
Post by alincon on Oct 10, 2020 21:28:21 GMT -5
I want to enable users to edit a table file. Aren't there commands to load the whole file, and to save the whole file? Should I use a text editor instead of a text window?
r.m.
|
|
|
Post by tsh73 on Oct 11, 2020 12:51:11 GMT -5
Well, (help says) in a textwindow you will not get anything but big texteditor. No buttons, nothing. But it handles trapclose and could take a menu (though it positions before build-in File and Edit) As for reading / writing whole file, have a look.
nomainwin
MENU #txt, "&Help", "About", [about] open "test" for text as #txt #txt "!trapclose [quit]"
open "C:\boot.ini" for input as #inFile 'my system has this file. Put file your have.
#txt "!contents #inFile" 'read whole file 'or 'aStr$=input$(#inFile, lof(#inFile)) 'read whole file '#txt "!contents aStr$" 'put it to text control
close #inFile wait
[quit] CONFIRM "Do you want to save the file?"; ans$ if ans$ = "yes" then #txt "!contents? string$"; 'get whole contents of text control open "c:\bootCopy.txt" for output as #outFile #outFile, string$; 'save all contents at once close #outFile 'wait a bit so file get written timer 200, [wai] wait [wai] timer 0 run "notepad.exe c:\bootCopy.txt" end if close #txt end
[about] notice "from text window"+chr$(13)+"So, text window could have menu" wait
|
|
|
Post by Rod on Oct 11, 2020 13:26:26 GMT -5
There are several "grid" demos posted that would handle editing table data.
|
|