Text Viewer
-
Hi, Does anyone know of a Text Viewer, (for basic .txt Files) which does NOT facilitate editing or Saving. :)
Bram van Kampen
-
Hi, Does anyone know of a Text Viewer, (for basic .txt Files) which does NOT facilitate editing or Saving. :)
Bram van Kampen
No, but I am sure it would take about 30 seconds to write one.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
No, but I am sure it would take about 30 seconds to write one.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
That'd be if you could install VS on a 386 then ?
Candy: Here's the plan: we changes our names, move to a distant island, and disguise ourselves as a family of traveling donkey polishers.
It takes VS 2008 20 seconds to start on my machine, and at least 8 seconds to compile the most basic app....
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
No, but I am sure it would take about 30 seconds to write one.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Hi,
Christian Graus wrote:
No, but I am sure it would take about 30 seconds to write one.
Well I thought that, until I tried. The CEdit Control turns Gray if you make it 'Read Only', and limits to 32757 lines. Try a ListBox instead, and you are limited to 32757 lines, and you have to implement the Edit\Copy Interface and Selection Interface yourself. Notepad has None of these limitations, but allows a User to Modify and save. Googeling the question results in solutions which pride themsevelves in advanced Editing features, exactly what I Do NOT want! Hence the Question. Regards, :)
Bram van Kampen
-
It takes VS 2008 20 seconds to start on my machine, and at least 8 seconds to compile the most basic app....
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
6 secs to start and populate the Start page (don't ask me why I haven't disabled that, I don't know why.) Compiling is OK but I don't work on large projects....
Candy: Here's the plan: we changes our names, move to a distant island, and disguise ourselves as a family of traveling donkey polishers.
-
Hi,
Christian Graus wrote:
No, but I am sure it would take about 30 seconds to write one.
Well I thought that, until I tried. The CEdit Control turns Gray if you make it 'Read Only', and limits to 32757 lines. Try a ListBox instead, and you are limited to 32757 lines, and you have to implement the Edit\Copy Interface and Selection Interface yourself. Notepad has None of these limitations, but allows a User to Modify and save. Googeling the question results in solutions which pride themsevelves in advanced Editing features, exactly what I Do NOT want! Hence the Question. Regards, :)
Bram van Kampen
Is the 32757 line limit a major issue ? Because the rest seems easy to deal with. Just don't make it read only, but write code to reject all keypresses.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hi, Does anyone know of a Text Viewer, (for basic .txt Files) which does NOT facilitate editing or Saving. :)
Bram van Kampen
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}private void textBox1\_DragDrop(object sender, DragEventArgs e) { string\[\] files = (string\[\])e.Data.GetData(DataFormats.FileDrop); StringBuilder sb = new StringBuilder(); foreach (string path in files) { if (System.IO.Directory.Exists(path)) { AppendFolder(sb, path); } else { sb.AppendLine(System.IO.File.ReadAllText(path)); } } textBox1.Text = sb.ToString(); } private void AppendFolder(StringBuilder sb, string path) { string\[\] files = System.IO.Directory.GetFiles(path); foreach (string subpath in files) { if (System.IO.Directory.Exists(subpath)) { AppendFolder(sb, subpath); } else { sb.AppendLine(System.IO.File.ReadAllText(subpath)); } } } private void textBox1\_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Copy; } } }
}
Form1.Designer.cs:
namespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <
-
Is the 32757 line limit a major issue ? Because the rest seems easy to deal with. Just don't make it read only, but write code to reject all keypresses.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
Is the 32757 line limit a major issue ? Because the rest seems easy to deal with. Just don't make it read only, but write code to reject all keypresses.
Yes, it is! We have Basic Log Files, which record transactions in ASCII, and which would cover up to six years of trading. The biggest sofar contans 425,000 lines. it is not accessed very frequently, but, the concern is that we have no tool to access it which disallows modification. Notepad loads it Sofar No Problems, it Takes a Long Time, No Problem, but it facilitates modification.
Bram van Kampen
-
No, but I am sure it would take about 30 seconds to write one.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Took me a few minutes. The drag/drop logic tripped me up a bit.
-
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}private void textBox1\_DragDrop(object sender, DragEventArgs e) { string\[\] files = (string\[\])e.Data.GetData(DataFormats.FileDrop); StringBuilder sb = new StringBuilder(); foreach (string path in files) { if (System.IO.Directory.Exists(path)) { AppendFolder(sb, path); } else { sb.AppendLine(System.IO.File.ReadAllText(path)); } } textBox1.Text = sb.ToString(); } private void AppendFolder(StringBuilder sb, string path) { string\[\] files = System.IO.Directory.GetFiles(path); foreach (string subpath in files) { if (System.IO.Directory.Exists(subpath)) { AppendFolder(sb, subpath); } else { sb.AppendLine(System.IO.File.ReadAllText(subpath)); } } } private void textBox1\_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Copy; } } }
}
Form1.Designer.cs:
namespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <
Does it allow more than 32767 lines ? It occured to me that part of of the issue could be that the op didn't want managed code, and that it would be tricker with the older MFC controls perhaps.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}private void textBox1\_DragDrop(object sender, DragEventArgs e) { string\[\] files = (string\[\])e.Data.GetData(DataFormats.FileDrop); StringBuilder sb = new StringBuilder(); foreach (string path in files) { if (System.IO.Directory.Exists(path)) { AppendFolder(sb, path); } else { sb.AppendLine(System.IO.File.ReadAllText(path)); } } textBox1.Text = sb.ToString(); } private void AppendFolder(StringBuilder sb, string path) { string\[\] files = System.IO.Directory.GetFiles(path); foreach (string subpath in files) { if (System.IO.Directory.Exists(subpath)) { AppendFolder(sb, subpath); } else { sb.AppendLine(System.IO.File.ReadAllText(subpath)); } } } private void textBox1\_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Copy; } } }
}
Form1.Designer.cs:
namespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <
Hi, Looks Fine. However I cannot compile that. Could you send me a Compiled version of that? I'll include you in the Credits. (Better: Include your Contribution in the Compiled Version) email: bramvankampen@aol.com :) :) :) regards
Bram van Kampen
-
Does it allow more than 32767 lines ? It occured to me that part of of the issue could be that the op didn't want managed code, and that it would be tricker with the older MFC controls perhaps.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Yeah, you just set the MaxLength property to 0.
-
Hi, Looks Fine. However I cannot compile that. Could you send me a Compiled version of that? I'll include you in the Credits. (Better: Include your Contribution in the Compiled Version) email: bramvankampen@aol.com :) :) :) regards
Bram van Kampen
You should get him to add file/open functionality instead of just drag/drop. The Express Edition of C# is, however, free.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Does it allow more than 32767 lines ? It occured to me that part of of the issue could be that the op didn't want managed code, and that it would be tricker with the older MFC controls perhaps.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
All our Code is in MFC. We do not use Managed Code.
Bram van Kampen
-
You should get him to add file/open functionality instead of just drag/drop. The Express Edition of C# is, however, free.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
You should get him to add file/open functionality instead of just drag/drop
Haha, I'm done with charity for the day. Maybe you'd like to incorporate Syslog exception logging, printing functionality, syntax highlighting, layout settings, and so on?
Christian Graus wrote:
The Express Edition of C# is, however, free.
Bingo.
-
Christian Graus wrote:
Is the 32757 line limit a major issue ? Because the rest seems easy to deal with. Just don't make it read only, but write code to reject all keypresses.
Yes, it is! We have Basic Log Files, which record transactions in ASCII, and which would cover up to six years of trading. The biggest sofar contans 425,000 lines. it is not accessed very frequently, but, the concern is that we have no tool to access it which disallows modification. Notepad loads it Sofar No Problems, it Takes a Long Time, No Problem, but it facilitates modification.
Bram van Kampen
Hmmm... if I was going to read 425,000 lines of text, I expect I'd offer search throughout the entire document, but I would not present it all to the user, I'd page it, and/or show as much as I got out of a search.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hi, Does anyone know of a Text Viewer, (for basic .txt Files) which does NOT facilitate editing or Saving. :)
Bram van Kampen
less file.txt
-
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}private void textBox1\_DragDrop(object sender, DragEventArgs e) { string\[\] files = (string\[\])e.Data.GetData(DataFormats.FileDrop); StringBuilder sb = new StringBuilder(); foreach (string path in files) { if (System.IO.Directory.Exists(path)) { AppendFolder(sb, path); } else { sb.AppendLine(System.IO.File.ReadAllText(path)); } } textBox1.Text = sb.ToString(); } private void AppendFolder(StringBuilder sb, string path) { string\[\] files = System.IO.Directory.GetFiles(path); foreach (string subpath in files) { if (System.IO.Directory.Exists(subpath)) { AppendFolder(sb, subpath); } else { sb.AppendLine(System.IO.File.ReadAllText(subpath)); } } } private void textBox1\_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Copy; } } }
}
Form1.Designer.cs:
namespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <
A TextBox??? Geez! That's limited to 64 KB or around that. Can't believe you didn't use a RichTextBox. Shame on you. Now you'll get featured in the Coding Horrors forum ;P
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
Hi,
Christian Graus wrote:
No, but I am sure it would take about 30 seconds to write one.
Well I thought that, until I tried. The CEdit Control turns Gray if you make it 'Read Only', and limits to 32757 lines. Try a ListBox instead, and you are limited to 32757 lines, and you have to implement the Edit\Copy Interface and Selection Interface yourself. Notepad has None of these limitations, but allows a User to Modify and save. Googeling the question results in solutions which pride themsevelves in advanced Editing features, exactly what I Do NOT want! Hence the Question. Regards, :)
Bram van Kampen
You can use a rich text control and make it read only. It can display really large text files (once you get too large it will be very slow).
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link