LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
PJM_Labview

Render tab character in string control

Status: New

In most software a tab character (/t) is "visually equivalent" to several space characters (see tab list below in notepad).

 

8-30-2011 2-34-58 PM.png

 

Unfortunately in LabVIEW, a tab character is visually equivalent (in normal display mode) to 1 space character. I am proposing that this should be change to be n space character.

 

8-30-2011 2-38-00 PM.png



  


vipm.io | jki.net

13 Comments
tst
Knight of NI Knight of NI
Knight of NI

Just to clarify - in most programs a tab is not represented as N spaces, but as a series of columns which are N spaces apart. A tab char brings the text to the next column, regardless of how far it is. This is useful for alignment.


___________________
Try to take over the world!
Manzolli
Active Participant

Agree with tst. THe idea is good, but the behavior should be better discussed.

André Manzolli

Mechanical Engineer
Certified LabVIEW Developer - CLD
LabVIEW Champion
Curitiba - PR - Brazil
Mr.Mike
NI Employee (retired)

Sometimes a tab moves forward to the next column.  Sometimes it's just equivalent to n spaces.  It's different depending on the application.  For most programming environments it's equivalent to a number of spaces and you can make the editor replace tabs with spaces.  I think if we had a rich text control, we'd want to move forward to a the next column.  But if you have a plain string control, it'd just be spaces.  Or would that be too confusing?

 

If we're talking about columns, we need to figure out how far apart each column is.  If we're talking about spaces, we need to figure out how many spaces represent a tab.  For both we need to figure out if it's user-settable ("user" as in you guys, or "user" as in your customers) or just some fixed value in LabVIEW.

-- Mike
PJM_Labview
Active Participant

I may not have been clear in the description, but when I say n space I meant that the column width appear to be n space wide.

I agree with tst, this has to be represented as a column (and not n space).

It would be ok to have a setting for the column width (but I dont think that this is critical).



  


vipm.io | jki.net

Manzolli
Active Participant

Originally it was 8 spaces. Some environment, like Visual Basic, which the standard is 4 spaces, it cam be configured. This works fine with fixed size fonts. For proportional fonts a fixed number of spaces is a mess. In this case a distance is determined and it's related to the margin. Check this article http://en.wikipedia.org/wiki/Tab_character#Tab_characters

André Manzolli

Mechanical Engineer
Certified LabVIEW Developer - CLD
LabVIEW Champion
Curitiba - PR - Brazil
PJM_Labview
Active Participant

For proportional fonts a fixed number of spaces is a mess.

Exactly. This is why the column / fixed distance is required.



  


vipm.io | jki.net

AristosQueue (NI)
NI Employee (retired)

The times when it matters whether it is N spaces or "next column delimiter" is when the tab is embedded inside the string. At the beginning of the string, it can be defined either way and really doesn't matter. Inside the string, it's the difference between this:

 

My\tString                    My        String

MyOther\tString      >>>>>    MyOther        String

 

where the tab is 8 spaces and this:

 

My\tString                    My      String

MyOther\tString      >>>>>    MyOther String

 

where the tab is next column at 8 character intervals. Although this is most readily recognizable with the fixed width font, similar options apply when using a variable width font.


Peter_FitzGerald
Member

A very good idea

It is generally agreed that TAB should cause the cursor to move to the beginning of the next "column",

For fixed width fonts the "column" width can be expressed as N characters

For proportional fonts the "column" width can be expressed as %  (of the Text.Size.Width)

This functionality could be implemented by adding 3 new string properties...

    TabEnabled (Boolean, default=false)

    TabWidth (Numeric)

    TabWidthUnit (Enum: Characters, % of Width)

Peter_FitzGerald
Member

Improvement over my previous proposition...

It is generally agreed that TAB should cause the cursor to move to the beginning of the next "column",

For fixed width fonts the "column" width can be expressed as N characters or N pixels

For proportional fonts the "column" width can be expressed as N pixels

This functionality could be implemented by adding 3 new string properties...

    TabEnabled (Boolean, default=false)

    TabWidth (Numeric)

    TabWidthUnit (Enum: Characters, pixels, % of Text.Size.Width)

PalleM
Member

I would love to see this implemented, Peter_FitzGerald's solution would be nice.

 

For now, im using below code. As mentioned above, "number of spaces" should be 8 for the courier font 

Replace TAB with x spaces.png