multiple *.txt document classes

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
jazzastronomer
Posts: 34
Joined: Sat Nov 03, 2007 3:04 am

multiple *.txt document classes

Post by jazzastronomer »

Does Textpad support multiple document classes for the same extension (*.txt)

I am trying to create a class that will open a *.txt file with a non-proportional font, another class for a proportional font and yet another class with a ligature font, all with the same *.txt extension.

I have the classes built but I got several warning messages.

However the open file dialog box doesn't have the new document classes listed (open as file type)

suggestions?
User avatar
AmigoJack
Posts: 515
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

The problem is you only think about the "Open" dialog, but there are a couple of other ways to make TextPad read a file (drag'n'drop, shell extension, start parameter, Explorer filename extension association...) and none of them can ask you which of your multiple classes should be used.

It'd be easier (also for other programs) if you just introduce your own filename extensions, just like Windows wants it for decades already.
jazzastronomer
Posts: 34
Joined: Sat Nov 03, 2007 3:04 am

thanks for the suggestion

Post by jazzastronomer »

I am trying to duplicate the functionality I have in my freeware text editor.

Textpad "knows" about the document classes so it might be possible to view an opened file with any of the available document class types. I just haven't figured out how to get Textpad to do this.

I was hoping somebody might have already figured this one out

thanks
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

You can open the properties page for the current document with
View | Document Properties or <Alt+Enter>,
select the Syntax tab,
select Enable syntax highlighting,
and choose a Syntax definition file.

Is that what you are looking for?
jazzastronomer
Posts: 34
Joined: Sat Nov 03, 2007 3:04 am

clarification

Post by jazzastronomer »

I have created 3 new document classes all with the *.txt extension

1) a non-proportional font
2) another class for a proportional font
3) yet another class with a ligature font

When I open a *.txt file Textpad is using it's existing *.txt document class and disregards my custom classes.

How do I get Textpad to display my *.txt file using my custom document class?
User avatar
AmigoJack
Posts: 515
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

You just repeated yourself (compare what you wrote with your first post), but why?
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

I don't think TextPad is designed to have more than one document class associated with a file extension, which is why you got those warning messages.

TextPad has no way of knowing which document class to use when you open a file if you have two document classes for the one extension.

The file type dropdown in the Open dialog isn't intended for selecting the document class. It's just for filtering the file names, which is standard functionality in the Windows Open File dialog. Notice that "Clip Library (*.tcl)" is in the dropdown and is not a document class. Also notice that if you create a new document class with a new file extension, it does not appear in the Open dialog.

So I would say the short answer to your question "Does Textpad support multiple document classes for the same extension (*.txt)" is No.
jazzastronomer
Posts: 34
Joined: Sat Nov 03, 2007 3:04 am

Post by jazzastronomer »

thanks ak47wong.

I came to the same conclusion that you did.
As a work around I can use the alt-enter method suggested earlier to change fonts & syntax file on the fly.

I had forgotten that Textpad doesn't like preference changes when there is a file open. Darn! I used to know that.

Anyhow I sent a email to support requesting that they add a feature to view an already opened file with a different document class.

If there is a way I'll post it.

Meanwhile my plan to cut down on the number of text editors I use is not going well.

thanks all
very helpful
Post Reply