I have a request to implement a way to add tab leaders to a document, for example:
Sales Price ........................ $250,000.00
The idea is to fill in the space of a tab character with a row of dots, or some other character.
Unfortunately, I can't seem to find a built-in way to do this in TextControl. I did find this one article that describes how to simulate it with the KeyDown and KeyUp events:
It's a clever trick, I grant you, but it still has a lot of shortcomings:
1. Requires a lot of cursor positioning manipulations on the part of the our application and insertion of single characters at a time. This adds a lot of manipulations to the undo buffer that will likely annoy our customers.
2. Users will not want to backspace through a bunch of dots to delete the tab.
3. There is not a practical way to associate specific tabs on specific paragraphs with specific leader text. I know our users will want to do this, have some tabs generate leaders and others just be an ordinary tab.
4. Any changes to the formatting (repositioned tab, change in font size) will wreck the appearance of the leader. It would be very cumbersome to detect and handle this in our application code.
Can this please be added as a feature to TextControl if it is not already?
The ParagraphFormat class currently offers TabPositions and TabTypes properties. I would recommend adding another property called TabLeaders which would default to an empty string, but could be set to a string of one or more characters. That way you could do something like this:
The leader text would still need to be represented as a single tab character behind the scenes, and selectable as a single character.
The leader text would stay with the tab stop, not the tab character. Therefore, copying and pasting the tab to another spot would take the leader text of the tab stop you copied to, instead of the leader text of the tab you copied from.
The Tabs dialog, available by right-clicking on the RulerBar, would need to be modified to add a field for the leader text.
In the meantime, I am going to suggest to our staff and users that they format their tab fonts with an underscore to simulate a leader, but I hope you can give this request serious consideration for an upcoming release.
Comments (1)
Yes, please, we need leader capability.
I have a request to implement a way to add tab leaders to a document, for example:
Sales Price ........................ $250,000.00
The idea is to fill in the space of a tab character with a row of dots, or some other character.
Unfortunately, I can't seem to find a built-in way to do this in TextControl. I did find this one article that describes how to simulate it with the KeyDown and KeyUp events:
http://www.textcontrol.com/en_US/downloads/library/snippet/leadingdots/
It's a clever trick, I grant you, but it still has a lot of shortcomings:
1. Requires a lot of cursor positioning manipulations on the part of the our application and insertion of single characters at a time. This adds a lot of manipulations to the undo buffer that will likely annoy our customers.
2. Users will not want to backspace through a bunch of dots to delete the tab.
3. There is not a practical way to associate specific tabs on specific paragraphs with specific leader text. I know our users will want to do this, have some tabs generate leaders and others just be an ordinary tab.
4. Any changes to the formatting (repositioned tab, change in font size) will wreck the appearance of the leader. It would be very cumbersome to detect and handle this in our application code.
Can this please be added as a feature to TextControl if it is not already?
The ParagraphFormat class currently offers TabPositions and TabTypes properties. I would recommend adding another property called TabLeaders which would default to an empty string, but could be set to a string of one or more characters. That way you could do something like this:
_txTextControl.Paragraphs[0].Format.TabPositions[1] = 7200;
_txTextControl.Paragraphs[0].Format.TabTypes[1] = TabType.RightTab;
_txTextControl.Paragraphs[0].Format.TabLeaders[1] = ".";
Sales Price ......................... $250,000.00
Or this:
_txTextControl.Paragraphs[0].Format.TabPositions[1] = 7200;
_txTextControl.Paragraphs[0].Format.TabTypes[1] = TabType.RightTab;
_txTextControl.Paragraphs[0].Format.TabLeaders[1] = " .";
Sales Price . . . . . . . . . . . . . $250,000.00
Or this:
_txTextControl.Paragraphs[0].Format.TabPositions[1] = 7200;
_txTextControl.Paragraphs[0].Format.TabTypes[1] = TabType.RightTab;
_txTextControl.Paragraphs[0].Format.TabLeaders[1] = "--+";
Sales Price --+--+--+--+--+--+--+--+ $250,000.00
The leader text would still need to be represented as a single tab character behind the scenes, and selectable as a single character.
The leader text would stay with the tab stop, not the tab character. Therefore, copying and pasting the tab to another spot would take the leader text of the tab stop you copied to, instead of the leader text of the tab you copied from.
The Tabs dialog, available by right-clicking on the RulerBar, would need to be modified to add a field for the leader text.
In the meantime, I am going to suggest to our staff and users that they format their tab fonts with an underscore to simulate a leader, but I hope you can give this request serious consideration for an upcoming release.