Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Special !

Mobile version of
the aldweb Site

Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]

Weather / Spam / www

Lyon Weather

aldweb against spam

To receive news about this website, consider subscribing to our Newsletter.
298 Subscribers
Family's web sites

Webmaster - Infos
Friends News


   visitors online

What do you think of the new design of the aldweb Site?
Great !
So ugly...
forum.gifForum - iziBasic - Topic #1169

Forum - Forum
iziBasic - iziBasic

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

active  Topic # 1169  Feature Request for Text Fields

14/03/2005 @ 19:27
by Joshua Cook


I am a registered user. In developing a small program, it occurred to me that it would be nice to have the ability for text fields and numeric fields to specify a justification. In other words, I would like to have the option to specify whether or not I want the text or numbers in the box to be left justified, center justified or right justified. I envision the syntax to be something like NUMFIELD #1, $­­a,0,10,20,30,15,2 (0=left,1=center,2=right). The reason I want such a thing is primarily to make numbers line up, but I also think it would be useful for other aesthetic reasons. I feel sure I am not the only one that would use such functionality.

If such a thing is already possible (perhaps using PP) I would also be interested in knowing about it. Again, thanks for a great program!
Write to Joshua Cook   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1
14/03/2005 @ 21:16
by aldweb


Hello Joshua,

Let me start by a copy & paste of the official Palm OS documentation:
(...)either of the values leftAlign or
rightAlign to specify left justification or
right justification, respectively. The
centerAlign value is not supported.

This answers part of your question. In iziBasic, I "shortcuted" to leftAlign only as you figured it out.

You could very well change the behaviour of a FIELD with PP. For this, you will need to:
1. retrieve the field's attributes with the use of the FldGetAttributes API call
2. after that parse the Attributes UInt16 variable (each bit corresponds to one attribute)
3. replace the justification bits (2 bits for justification coding) by the new value you want
4. and, almost last step, call the FldSetAttributes API to update the attributes
5. last but not least, call the FldDrawField API to update the field according to the new attributes

This is quite complex to do

Meanwhile, you may use tricks to succeed.
=> I think about this one for instance:
1. use a fixed font (see SETFONT)
2. calculate the number of digits, that I will call N (and, in M, I put the maximum number of digits)
3. add M-N spaces in front of a variable$­­
4. update the FIELD with this value, which is now right justified
=> And also this one:
1. use LABEL instead of FIELD
2. calculate a string's width with FONTWIDTH, let's store it in F.
3. put the label at X-F where X is the right fixed margin for your number

Overall, the trouble for me is:
1. if I put all options offered by PalmOS to the different objects, all their syntaxes will end up with 15 or 20 parameters... much too long!
2. if I stick to what I believe to be OK in 90% of the cases... I end up with requests like yours!


Write to aldweb   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2
15/03/2005 @ 12:53
by Khertan


Doing it with space is the way i use ...
It s a tradition in all basic to do that ...

It s the reason that the only language having SPACE instruction is the basic :)
Write to Khertan   Post an answer  Top
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
Forum Topic  Forum 

^ Top ^