NetTalk Central

Author Topic: Field/String/Width(chars)  (Read 3851 times)

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Field/String/Width(chars)
« on: January 23, 2014, 02:38:35 PM »
Hi

I don't quite understand this setting.  It looks like it relates to the box that contains the field - if you set the Width = 4 and then change it to 5 then the box gets wider.

But it does not seem to be related to the actual width of the field which is in the box .  For example, I have a Real field with Screen picture @N_5B which means that I can display 5 significant digits of the number.  If I set Width=4 then the number 10152 (5 digits) is successfully displayed.

So I am going to keep Width=4 so that fields are as compact as possible but why can I display 5 digits?

Thanks

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Field/String/Width(chars)
« Reply #1 on: January 23, 2014, 09:48:20 PM »
Hi Keith,

there are actually 3 settings in play here;

a) the picture of the "data"
b) the width of the text entry field on the screen
c) the maximum number of characters which can be entered into the field.

Regarding (b) since most fonts have variable width, the size of the field is not a limitation on what can be entered, or displayed. clearly WWWWW takes more width than iiiii. Rather "width" has to do with a visual width, and is usually calculated based on wide characters. In your case you're using 5 fairly narrow characters, so they fit.

Cheers
Bruce

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Field/String/Width(chars)
« Reply #2 on: January 24, 2014, 12:51:01 PM »
Bruce

Excellent explanation.  It deserves to go into the 'Template Reference' since I am sure that there would be others who think of 'characters' as meaning 'number' rather than a pointer to 'total width'.

The Template Reference is a 'Gold' document and the richer its content the fewer questions will be posted on the Forum  :) You made an offer to accept updates from the community.  Based on your explanation of this setting, suggested words are:

Width (Characters)

Sets the width of the field in the browser.

Note that what actually gets displayed depends on:

a) the picture of the "data" (what is defined, say, in the dictionary as the screen picture - @N_5B)
b) the width of the text entry field on the screen (the space that is available)

The 'Width' setting here allows the space to be calculated.  Most fonts have variable width, the size of the field is not a limitation on what can be entered, or displayed. WWWWW takes more width than iiiii. 'Width' has to do with a visual width, and is usually calculated based on wide characters.

In the screen picture @N_5B the display characters are numbers which are 'narrow' and therefore will take up less space than alphabetical characters.  This means that you can afford to define Width= 4 for 5 numbers.  Understanding this helps in keeping screen displays compact.

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Field/String/Width(chars)
« Reply #3 on: January 26, 2014, 09:32:35 PM »
I have updated the docs, albeit in a somewhat less verbose way <g>.

cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Field/String/Width(chars)
« Reply #4 on: January 28, 2014, 10:56:34 AM »
Hi,

To create a universal length style I have created a global function:

_len(long pLength),long

The internals ar something like:

If pLength > 40
       Return(40)
Else
        Return(pLength)
End

In the width field I type:

_len(len(<field name>))

Of course it does not work for numeric data but it helps me to create nice looking forms

I created a same kind  of function for column width in browses and drop lists.

Cheers,
Rene
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Field/String/Width(chars)
« Reply #5 on: January 29, 2014, 08:04:12 AM »
There's also a method;

p_web.PicLength (picture)

which takes a picture, and returns the best length (in characters) for that picture.

Cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Field/String/Width(chars)
« Reply #6 on: January 29, 2014, 11:45:03 AM »
I didn't know that.
Also in NT6.53
It will probably make my apps even faster ;D
Rene Simons
NT14.14