Choice options field

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
JohnEngels
New User
Posts: 4
Joined: Fri Aug 11, 2017 2:33 am
First Name: John
Last Name: Engels
Company Name: BeesdA2 BV
Contact:

Choice options field

Post by JohnEngels »

I've added folowing into my chocie options field

LPAD(RLKCTL1B, 1) || ' -- ' || LPAD(RLBTW, 5) || '%'

In PUISSNVP I found

SELECT DISTINCT LPAD(RLKCTL1B, 1) || ' -- ' || LPAD(RLBTW, 5) || '%',
RLKCTL1B, RLKCTL1B
FROM CONTRL_T
ORDER BY RLKCTL1B

In SQL I get it nicely aligened
Choice options field -- SQL.jpg
Choice options field -- SQL.jpg (8.41 KiB) Viewed 2310 times
but in Profound I get it differently
Choice options field -- ProfoundUI.jpg
Choice options field -- ProfoundUI.jpg (8.16 KiB) Viewed 2310 times
Any ideas?

Thanks in advance,

John Engels
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Choice options field

Post by Scott Klement »

It's a difference between how a web browser works and how a green-screen works. In green-screen, all of the characters take up the same amount of space, and blanks also take up the same amount of space.

In the web world, a blank is only shown once, no matter how many there is. So 5 blanks and 1 blank are the same. And, each character takes up a variable width.
JohnEngels
New User
Posts: 4
Joined: Fri Aug 11, 2017 2:33 am
First Name: John
Last Name: Engels
Company Name: BeesdA2 BV
Contact:

Re: Choice options field

Post by JohnEngels »

Hi Scott,

thanks for your answer.

've taken a look at some discussions on the web and how this can be solved. That’s way out of my current knowledge.

Have experimented a little bit with adding “white-space: pre” into the CSS but that doesn’t seem to work. Guess we’ll have to take it as it is.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Choice options field

Post by Scott Klement »

What type of widget are you using the choice options field with? Is it dropdown, combo box or textbox?
JohnEngels
New User
Posts: 4
Joined: Fri Aug 11, 2017 2:33 am
First Name: John
Last Name: Engels
Company Name: BeesdA2 BV
Contact:

Re: Choice options field

Post by JohnEngels »

Currently I'm using a select box
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Choice options field

Post by Scott Klement »

If you wanted to be clever, you could change the font to a fixed-width font, and write a little JavaScript routine to replace the blanks with non-breaking spaces. That would work with a select box, I don't know about other widgets.

For example, for a select box that has an id property of "Dropdown1", I could set the "font family" property to Consolas (which is a fixed-width font):
dropdown1.png
dropdown1.png (12.67 KiB) Viewed 2263 times

Then in the "ondbload" function, put the following code:

Code: Select all

if (response.success) {
  var widget_id = response.id;
  setTimeout(function() {

    var dropdown = getObj(widget_id);
    for (var i=0; i<dropdown.options.length; i++) {
      dropdown.options[i].innerHTML = dropdown.options[i].innerHTML.replace(/ /g, "\u00A0");
    }

  }, 1);
}
This runs each time data is loaded from the database, and then replaces all spaces with Unicode U+00A0 characters (which are non-breaking spaces.) As long as you are using a fixed-width font family (such as Consolas in my example) this should allow your data to line up the way you want.
JohnEngels
New User
Posts: 4
Joined: Fri Aug 11, 2017 2:33 am
First Name: John
Last Name: Engels
Company Name: BeesdA2 BV
Contact:

Re: Choice options field

Post by JohnEngels »

It works now, thanks
Choice options field -- Works now.jpg
Choice options field -- Works now.jpg (9.9 KiB) Viewed 2259 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest