Focal Point
[CLOSED] Aligning concatenated fields in a combobox line item

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6737045426

September 27, 2012, 03:24 PM
gcarterIT
[CLOSED] Aligning concatenated fields in a combobox line item
I'll use a simple example o describe my issue, since it may be harder to describe with the actual code.

I have a combox where each line item is a concentenation of 2 fields. The physical appearance of the length of the 1st field will vary because either the character length is different (ex: 12 vs. 978), or the character spacing is different (ex: lll vs. WWW), or both.

My dropdown list currently looks something like this:

AAA - this is tiem one
111 - this is item two
1S - this item three

I want it to look like this:

AAA - this is item one
111 - this is item two
1S - this is item three

I've tried a few things, but to no avail. My greatest concern is there is nothing I can do about the variance in character spacing.

I was thinking that if I inserted a TAB between fields, as long as the 1st field did not exceed the TAB size, the 2nd fields would line up evenly.

Here is how I load the combo box:

-* create a 'tab'

compute AA1/A1 = 'A1';
compute TABB/A1=HEXBYT(09,AA1);

compute r/i4 = StkList.FocCount;
repeat while r GE 1;
Compute StkCodeList(r).CodeWithDescription =
' '
| StkCodeList(r).CLASS_CODE
| TABB
| ' - '
| StkCodeList(r).CLASS_DESC;
compute r=r-1;
endrepeat

But the TABB is replaced with a space, not a tab, and the second fields remain misaligned. And even if it did create the tab, I fear it still may not correct for a differnece in character spacing.

Any suggestions?

Thanks,
George

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6
Windows, All Outputs
September 27, 2012, 03:51 PM
Francis Mariani
The only thing you can do is to use a monospace font for this control, e.g. Courier New, but only if the correct number of spaces fill up the left side of that display value, i.e., two spaces after 1S

1S  - this is item three



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 27, 2012, 04:07 PM
gcarterIT
Thanks for the quick reply.

Considering...

1. a monospace font would not be consistent with the rest of form font

...and...

2. it sounds like I would have to prep the 1st field to have the proper number of spaces before the concatenation

...will probably leave as is. My user won't care, just looks tacky to me.


Thanks again,
George


WebFOCUS 7.6
Windows, All Outputs
September 28, 2012, 03:58 AM
Danny-SRL
Well...
2. If you are using a DEFINE to concatenate and simple concatenate (| and not ||), then the blanks will be kept with a monospace font, so
1. The user will be happy with what he gets and shouldn't care about what he sees.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

September 28, 2012, 08:14 AM
Maintain Wizard
Since it looks like you are using a Maintain form, a lot of time I'll use an HTMLTable to display multiple columns instead of a drop down box and just set a hiperlink on the first column.

Mark
September 28, 2012, 11:14 AM
gcarterIT
@Danny-SRL
Thanks for the suggestion. The user cares less about the misaligned fields in the dropdown box, than the font. This is one of many forms sharing the Arial font. Making this one form, or dropbox, monospace may be distracting and raise more questions than necessary.

@Maintain Wizard
Sounds like a good alternative, but will be inconsistant with the way other data is entered into the form; there are 2 other dropdowns on the same form. It also sounds like I may need to rearrange other controls to accommodate the HTMLTable. Again, this may be distracting and raise more questions than necessary.

I will double-check with the user, and if he's okay with its present appearance, I'm done; otherwise, I will revisit both your suggestions.

Thanks guys.


WebFOCUS 7.6
Windows, All Outputs
September 28, 2012, 02:13 PM
John_Edwards
If you are delivering the result to an html browser you can embed non-breaking spaces, which use the text

 & n b s p ; 


. . . to represent a blank character in your browser. Putting that string in instead of your tabs will allow you to get the indentation. You'll have to be creative to figure out how many spaces you need depending on the length of your character string.

In FOCUS this is trickier since it wants to use the string as an amper-variable. I get around that by setting the value as

 BLANKSPACE/A6 = '&' | 'nbsp;' ;


There is an escape character that allows you to avoid the two-part assembly, but I can never remember what it is.

J.



September 28, 2012, 02:30 PM
Francis Mariani
Except that an em is wider than an el, so it's really impossible to predict how many blanks are required.

One possibility is to put the code part of this text at the end of the description:

This is item one (AAA)
This is item two (BBB)
This is item three (1S)

instead of

AAA - this is tiem one
...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 01, 2012, 08:56 AM
gcarterIT
@John_Edwards

Thanks John. I'm thinking that's only half the solution. By that I mean it solves this problem:

xxx - abcde
xx - abcde

But it doesn't solve this problem:

WWW - abcde
ll - abcde

In other words, the physical spacing appearance of lll is different from WWW even though they're both 3 characters long. The spacing is only equivalent if a monospace font is used. From my research they're only a few tags that can be used within


WebFOCUS 7.6
Windows, All Outputs
October 03, 2012, 11:04 AM
gcarterIT
The user accepts the misaligned items.
Personally, I fine with that is long as I don't have to look at it Smiler

Thanks all.


WebFOCUS 7.6
Windows, All Outputs