Forum > Ported from Delphi/Kylix
RichMemo - open mytext.txt pls!
Nicole:
I made an edit interface for rtf files, works fine.
I use an open dialog, which opens rtf-files fine.
What do I have to change, that my txt and ini files (or may be all others as well) are displayed too?
And to want it all:
Best would be a size check and an optional request as, 'do you really want to open the 10 GB-file in your text-editor'?
Thanks for hints.
My open dialog looks like this:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---object OpenDialog_RichMemo1: TOpenDialog DefaultExt = '.rtf' InitialDir = 'c:\' Left = 552 Top = 416end
rvk:
--- Quote from: Nicole on July 19, 2022, 04:39:12 pm ---What do I have to change, that my txt and ini files (or may be all others as well) are displayed too?
--- End quote ---
You can put this in TOpenDialog.Filter
My special files (rtf,txt,ini)|*.RTF;*.TXT;*.INI
(Everything before the | is a description, everything after is a list of *.ext separated by ; )
--- Quote from: Nicole on July 19, 2022, 04:39:12 pm ---Best would be a size check and an optional request as, 'do you really want to open the 10 GB-file in your text-editor'?
--- End quote ---
Not sure if that's possible.
You can always check the size after selecting it and asking "Do you really want to open a xx-GB file" directly after.
Nicole:
thank you!
I will do this.
And thanks for the hint about the pipe-symbol.
Is it possible to let the user open ALL files, if he wants to?
May be on a second click as "warning"?
There is software allowing *.*, but most times it does not work well and needs some unlogic clicks.
rvk:
--- Quote from: Nicole on July 19, 2022, 05:07:58 pm ---Is it possible to let the user open ALL files, if he wants to?
May be on a second click as "warning"?
There is software allowing *.*, but most times it does not work well and needs some unlogic clicks.
--- End quote ---
You can expand the pipe sign with other options.
For example:
My special files|*.RTF;*.TXT;*.INI|Other files|*.*
This will give you initially the "My special files" and the user can choose "Other files" for *.* from the dropdown.
You can give even more than 2 options.
My special files|*.RTF;*.TXT;*.INI|MeMe files|*.MEME|Other files|*.*
Nicole:
Thanks.
A different problem occurs:
The text-file is not displayed.
So the mytext.rtf shows content, the mytext.txt shows nothing but a blanc side.
Navigation
[0] Message Index
[#] Next page