I have this large text that I want to display which I get from a file using String Theory, and the size of this text exceeds the variable limits in clarion.
I felt that RTF text control could handle it and did few tests but failed.
Any suggestions are appreciated.
I am using Clarion 6.3
The max I think you can load is like 20-30k in C6.3. And that max changes as you add more text controls to the window. I think I recall using the RTF attribute to get more in there.
Doc shows the max for a string is 4MB
What you can do is put the file into a queue and show the contents in a list.
You can work out the line wrapping by putting part of the file into a text control and extract the lines via property syntax
see ?Text{prop:line,n} and ?Text{prop:linecount}
Another approach would be to use scintilla. See the open source KSS as an example of how to use scintilla in your code
I already did something similar by slicing the st.GetValue() using the SUB function to display one part of the value in a screen variable with 4MB length each time controlled by back and forward buttons (Paging) and it is working fine.
But I was thinking about finding a way to display the value of the string fully in one box.
This is the limit for size of any declared variable or structure. There is no such restriction for data objects allocated in the heap. For example,
SR &STRING,AUTO
...
SR &= NEW STRING (64*1024*1024)
is good.
“Normal” TEXT controls can display text of size less than 64K. This is restriction for Windows controls with class “Edit”. RTF controls can display text of practically any size.
Yes you are right (and this is what I used in paging) as using st.value in this process delays the display, so I adjust the width of the variable to save the st.value to . But still I could not get it to fit in the box.
anyhow I tested the method and it was ok for normal size files but for big files it starts displaying and suddenly the box turns to blank (screen is still active and working), so it seems it loads until a certain limit only.
I quickly tested the Codejock SytntaxEdit control inside a clarion app - it was our demo app compiled in c10, but the results should be the same for a c6 app too.
I tested text files of the following sizes - all opened and allowed you to continue editing etc…
10k, 100k, 1mb, 10mb, 100mb and 1gb
I have to admit moving around and typing additional text did slow down when using the 1gb text file - but considering the size of the content I think that’s ok
Anyway, just thought I’d let you know the results. If you do need it testing in c6.3 then let me know and I’ll re-run the tests on a Win7 VM I have for c6 dev / testing.
How large is the text size? I just converted 2 e-books to RTF and they were loaded and displayed without problems using the RichEdit demo program. One of RTF files has size 19 MB, other one - almost 39 MB. Texts includes different fonts and embedded images.
Sorry to surprise you but I am talking about 1.8GB text file (actually csv) which can be operated but not displayed inside the clarion screen except by paging as I mentioned before.
The file can be opened with a third party like Notepad++ (which I am using now using RUN command)
Win32 programs can access only 2 GB memory below address 80000000h. All stuff working not in the kernel/driver mode must be loaded below this bound. So, really, files of size 1.8GB can’t be loaded to the program memory completely. Loading such files by pages is the only way. 64-bit programs do not load such large files completely too.
Not until the 18th post you mention that your “large” is 1.8 GB . You do mean 1.8 Billion bytes?
I wonder who is going to page through 1.8 GB of CSV data and glean anything. At 100 bytes/line that is 18 million lines. I would guess you just want a peek at the top and bottom of the file to see it is as expected. That the bottom as the new records you expect.
Since C9 or C10 the BASIC driver supports PREVIOUS. That would let you can view a CSV file using the normal Browse template so it is page loaded like with a TopSpeed file.
Since you are in C6 then I would build a TPS file to Index the CSV file. Something with minimal info
CsvIndex FILE,DRIVER('TopSpeed'),PRE(CsvInx)
KeyLineNo KEY(CsvInx:LineNo)
RECORD
LineNo LONG
SliceBeg LONG
SliceLen LONG
Then you can Browse that TPS file allowing page loading. In Format Element of the Browse Queue do a GET(CsvFile,SliceBeg,SliceLen) to have the CSV line to show in the Browse. I would probably use the DOS driver for that GET. You could put a STRING and a KEY if you wanted a way to sort. I would be trying to keep the TPS small.
My helper class Bug Bang for String Theory shows how to make a Virtual List Box view an ST CSV file:
In one of my previous posts, I mentioned that I have been using clarion since 2000.
Although it is not the language I use for work, I enjoy using it for personal projects. I find it fun to create my own tools to help me in my digital life, and I believe that clarion can produce applications that are comparable to well-known tools.
This presents a challenge for me, and while some may ask why I bother reinventing the wheel, I see it as an opportunity to learn something new every time I encounter a new problem.
Rather than simply seeking a solution, I am interested in exploring different perspectives and approaches to problem-solving. Thank you all for your contributions.