| View previous topic :: View next topic |
| Author |
Message |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 26, 2003 12:27 pm Post subject: Load textfile into EDIT and keeping format? |
|
|
Maybe someone could help me with a simple solution to loading a textfile (in Windows format) into a variable so I can use it in a EDIT object and keeping it's formatting. By that I mean, keeping the tabs and linebreaks.
Hope someone can help me with this
PS! I'm using the following formatting on the EDIT object: WRAP,MULTI,SCROLL,READONLY _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 26, 2003 12:35 pm Post subject: |
|
|
| Code: |
LIST CREATE, 1
LIST LOADFILE, 1, "C:\whatever.txt"
DIALOG SET, Edit1, @text(1)
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 26, 2003 12:36 pm Post subject: |
|
|
Thanks alot Mac. Worked perfectly  _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 26, 2003 12:49 pm Post subject: |
|
|
Wow, very nice code Mac.
Is it free to use? _________________
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Feb 26, 2003 12:59 pm Post subject: |
|
|
I think all code posted on this forum is free to use, as long as you put a 'Thanks to: ' in your about window...  |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 26, 2003 1:01 pm Post subject: |
|
|
All my posted code is free to use - however, that example is
not entirely mine.
Julian Moss is the original author, and here's what he had in
the original code (note the pun on "share" ware):
REM A program by Julian Moss -- 9th March 1999
REM ----------------------------------------
REM This demonstration application is share-ware.
REM If you make improvements to it, that illustrate other
REM useful techniques, please share them with others by
REM helping us to publish updates for this program.
I think any posted code is free (unless otherwise noted), but I'm
sure most folks would appreciate a mention if ya use their code
extensively though.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 26, 2003 1:05 pm Post subject: |
|
|
Thanks for the info Skit
BTW, I now get an error in my code. It's an errorcode 4 which from the helpfile:
| Quote: | 4 Invalid list operation
The string list or list box control referenced in this command does not exist..
Copyright © 1995 - 2002 S.A.D.E. s.a.r.l. / All rights are reserved. |
What does that mean?
I've checked that the object name is correct. It happens when I click between the tabs in my program. Any ideas? I'm using the code Mac put earlier. _________________
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Feb 26, 2003 1:06 pm Post subject: |
|
|
| Maybe you've hidden the element? Don't know if things like @match() are still working on hidden elements... |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 26, 2003 1:07 pm Post subject: |
|
|
Just a note on my post above, I've got the load list code by Mac twice in my program.
On the second list I changed the number 1 to 2. _________________
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 26, 2003 1:11 pm Post subject: |
|
|
Another note, it only appears to crash when I click the same tab twice. The first time I click the CREDTIS tab, then it's ok, then I click the About tab and back to the Credits tab that's when it crashes.
Do I have to empty the list or something before reload? _________________
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 26, 2003 1:17 pm Post subject: |
|
|
It's working now.
Thanks to Skit 3000 who told me to add LIST CLOSE,1 before Goto Evloop
thanks guys _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 26, 2003 1:27 pm Post subject: |
|
|
You can also put LIST CREATE, 1 at the start of your program,
then just use LIST CLEAR, 1 to empty it as needed. You don't
have to empty it when using LOADFILE, ASSIGN, etc. - they
replace the contents (if there are any).
Using LIST CREATE, 1 tries to re-create the same list if
ya use again it without closing the list.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Wed Feb 26, 2003 1:34 pm Post subject: |
|
|
Thanks for the tip Mac.
Is that faster or takes up less memory? _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 26, 2003 1:42 pm Post subject: |
|
|
Prolly not much difference if ya don't leave a list full of
data ya don't need.
Using LIST CLOSE will free up a tiny bit of memory that's set
aside for list creation, but leaving the list and clearing it is prolly
more efficient if you're gonna re-use the list all thru the program.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
|