Alaska Software Inc. - How to right and left justify an XBase string ?
Username: Password:
AuthorTopic: How to right and left justify an XBase string ?
Normand AubryHow to right and left justify an XBase string ?
on Tue, 08 Feb 2005 16:54:19 -0500
How to right and left justify an XBase string ?
Brent Dubs Re: How to right and left justify an XBase string ?
on Tue, 08 Feb 2005 16:02:52 -0600
It depends on how you're trying to use it. If you really mean justifing 
the contents of a string, then you could use PADL() or PADR(). If you 
are trying to display a string in an object and want it to appear 
justified, then look at the object :options variable.  For example 
oStatic:option := XBPSTATIC_TEXT_LEFT

Is that what you mean?

-Brent


Normand Aubry wrote:
> How to right and left justify an XBase string ? 
> 
>
Normand AubryRe: How to right and left justify an XBase string ?
on Tue, 08 Feb 2005 17:19:21 -0500
I want to printout with a column style output ?
Example:
It depends  on how you're  trying to use  it. If  you really mean justifing
the contents of a string, then you could use PADL() or PADR(). If you
are  trying   to display   a s tring in  an  object  and  want  it  to 
appear
justified, then look at the object :options variable.  For example



"Brent Dubs" <bdubs@vanityshops.com> a crit dans le message de news: 
u27K%23niDFHA.6152@S15147418...
> It depends on how you're trying to use it. If you really mean justifing 
> the contents of a string, then you could use PADL() or PADR(). If you are 
> trying to display a string in an object and want it to appear justified, 
> then look at the object :options variable.  For example oStatic:option := 
> XBPSTATIC_TEXT_LEFT
>
> Is that what you mean?
>
> -Brent
>
>
> Normand Aubry wrote:
>> How to right and left justify an XBase string ?
>
James Loughner Re: How to right and left justify an XBase string ?
on Tue, 08 Feb 2005 18:29:31 -0500
Then use the PADR/PADL functions also you will want to use a 
non-proportionate font like Courier.

Jim

Normand Aubry wrote:
> I want to printout with a column style output ?
> Example:
> It depends  on how you're  trying to use  it. If  you really mean justifing
> the contents of a string, then you could use PADL() or PADR(). If you
> are  trying   to display   a s tring in  an  object  and  want  it  to 
> appear
> justified, then look at the object :options variable.  For example
> 
> 
> 
> "Brent Dubs" <bdubs@vanityshops.com> a écrit dans le message de news: 
> u27K%23niDFHA.6152@S15147418...
> 
>>It depends on how you're trying to use it. If you really mean justifing 
>>the contents of a string, then you could use PADL() or PADR(). If you are 
>>trying to display a string in an object and want it to appear justified, 
>>then look at the object :options variable.  For example oStatic:option := 
>>XBPSTATIC_TEXT_LEFT
>>
>>Is that what you mean?
>>
>>-Brent
>>
>>
>>Normand Aubry wrote:
>>
>>>How to right and left justify an XBase string ?
>>
> 
>
B.I.KaarigstadRe: How to right and left justify an XBase string ?
on Wed, 09 Feb 2005 07:46:59 +0100
If you are using the GraStringAt function then look at GraSetAttrString, and 
GRA_HALIGN_...

B.I.Kaarigstad

"Normand Aubry" <normand.aubry@norja.net> skrev i melding 
news:$B9nKxiDFHA.6160@S15147418...
>
>
> I want to printout with a column style output ?
> Example:
> It depends  on how you're  trying to use  it. If  you really mean 
> justifing
> the contents of a string, then you could use PADL() or PADR(). If you
> are  trying   to display   a s tring in  an  object  and  want  it  to 
> appear
> justified, then look at the object :options variable.  For example
>
>
>
> "Brent Dubs" <bdubs@vanityshops.com> a crit dans le message de news: 
> u27K%23niDFHA.6152@S15147418...
>> It depends on how you're trying to use it. If you really mean justifing 
>> the contents of a string, then you could use PADL() or PADR(). If you are 
>> trying to display a string in an object and want it to appear justified, 
>> then look at the object :options variable.  For example oStatic:option := 
>> XBPSTATIC_TEXT_LEFT
>>
>> Is that what you mean?
>>
>> -Brent
>>
>>
>> Normand Aubry wrote:
>>> How to right and left justify an XBase string ?
>>
>
>
Jose ValleRe: How to right and left justify an XBase string ?
on Wed, 09 Feb 2005 03:52:10 +0100
I saw one message about this several months ago.

The Idea was to change the space between the characters until the string had 
the desired lenth. So the text was right and left-jutified.

sorry but I can not find it




"Normand Aubry" <normand.aubry@norja.net> escribi en el mensaje 
news:d6FzIjiDFHA.2692@S15147418...
> How to right and left justify an XBase string ?
>
Phil Ide
Re: How to right and left justify an XBase string ?
on Wed, 09 Feb 2005 09:55:20 +0000
Jose,

> I saw one message about this several months ago.
> 
> The Idea was to change the space between the characters until the string had 
> the desired lenth. So the text was right and left-jutified.

A much easier way (but check out B.I.'s suggestion first) is to call
GraQueryTextBox() to get the size of the string when printed.  Using this
method, you take al the guesswork out of it.

   nWidth := 500  width of target 'cell'
   nPos   := 600  left co-ord of target cell
   cString := "This is a right-justified string"

   aPoints := GraQueryTextBox( oPS, cString )
   aPos := { nCurRow, nPos - aPoints[3][1] }
   
   GraStringAt( oPS, aPos, cString )

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Read my lips... No more cows, man.
B.I.KaarigstadRe: How to right and left justify an XBase string ?
on Wed, 09 Feb 2005 14:24:39 +0100
nop, you are wrong, and then of course me too 
Jose is rigth.
Had a second look at Normand's second msg, and I now see the what he wants 
is what I think is called newspaper justification. A coloum where all lines 
are equaly long.
But I could not find any msg. about it, only those where using write or 
simelar was mentiond.

B.I.Kaarigstad


> A much easier way (but check out B.I.'s suggestion first) is to call
> GraQueryTextBox() to get the size of the string when printed.  Using this
> method, you take al the guesswork out of it.
Phil Ide
Re: How to right and left justify an XBase string ?
on Wed, 09 Feb 2005 14:28:58 +0000
B.I.,

> nop, you are wrong, and then of course me too 
> Jose is rigth.
> Had a second look at Normand's second msg, and I now see the what he wants 
> is what I think is called newspaper justification. A coloum where all lines 
> are equaly long.

Aaah, with each line jsutified at both ends, with spaces inserted between
words to make this happen.

Actually this is easier than it first looks.


    get total width of line
   nWidth := 1050

    get size of white-space
   nWidth -= GraQueryTextBox(StrTran(cString,' ',''))[3][1]

Next, count the number of words, and:

   nBlankSize := nWidth /(number_of_words - 1)

or:

   nBlankSize := nWidth /(number_of_space_between_words)

nBlankSize is now the average size of a blank.  You can now print each
word, incrementing the column value by nBlankSize each time.  Note that you
will almost certainly have to keep track of the number of words printed,
and insert an additional point (pixel or whatever) for appropriate
sub-decimal values of nBlankSize.

E.g. if nBlankSize is 21.02, then every fifth blank needs to be 22 rather
than 21.  Additionally, you will have to ensure that the last blank is
rounded up early if necessary.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

How do I set my laser printer on stun?
Phil Ide
Re: How to right and left justify an XBase string ?
on Wed, 09 Feb 2005 14:59:10 +0000
B.I.,

> E.g. if nBlankSize is 21.02, then every fifth blank needs to be 22 rather
> than 21.

... that was meant to be 21.20 

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Open the restroom door, HAL...HAL...I'm not kidding, HAL...