Width - Keeping all your characters in line
Posted: February 26th, 2006, 6:50 am
link: width-1.0.zip
That's right, another plugin fresh out of the linker. This is another one from my "string" library that I am developing.
What this plugin does is allow you to format a string such that it takes up an exact width. This can be done by filling in the extra spaces with a character of your choice, or optionally by truncating larger strings to fit. You can choose how the text should be justified within the field (left, right, or center), what character to use to fill (a space, by default), whether or not to truncate long lines, and most importantly, the width to make it.
Where might you use this? Well, I like the default Screen 2, except for a few things. For one, as the percentages vary between 1 and 3 digits, they shift all over the place. Normally numbers like that are right justified within a column, but there's no way to do this in Smartie: the most we have is using $Fill to make sure the bar graphs don't move as this happens.
Well, now you can control this perfectly! Use it to make columns, even stretching between lines, that line up perfectly and exactly how you want them. You could even use this to make cool effects (perhaps you want every blank space to actually be a block, or a custom character).
The most important thing you can do with an LCD is display text on it. The second most important thing is to make it look nice, and that's what Width is for. What's your Width?
That's right, another plugin fresh out of the linker. This is another one from my "string" library that I am developing.
What this plugin does is allow you to format a string such that it takes up an exact width. This can be done by filling in the extra spaces with a character of your choice, or optionally by truncating larger strings to fit. You can choose how the text should be justified within the field (left, right, or center), what character to use to fill (a space, by default), whether or not to truncate long lines, and most importantly, the width to make it.
Where might you use this? Well, I like the default Screen 2, except for a few things. For one, as the percentages vary between 1 and 3 digits, they shift all over the place. Normally numbers like that are right justified within a column, but there's no way to do this in Smartie: the most we have is using $Fill to make sure the bar graphs don't move as this happens.
Well, now you can control this perfectly! Use it to make columns, even stretching between lines, that line up perfectly and exactly how you want them. You could even use this to make cool effects (perhaps you want every blank space to actually be a block, or a custom character).
The most important thing you can do with an LCD is display text on it. The second most important thing is to make it look nice, and that's what Width is for. What's your Width?