Fermer I. aldweb

Fermer II. Gratuitiels PC

Fermer III. Gratuitiels Palm

Fermer IV. Partagiciels Palm

Fermer V. iziBasic Palm

Fermer VI. Connaissance Palm

Fermer VII. Ordinateur Poche

Fermer VIII. miniPortail

Spécial !

Version mobile
de l'aldweb Site

Ni Français, ni Anglais ?

Essayez donc l'un de ces drapeaux :
[de] [es] [it] [pt]

Météo / Spam / www

Météo Lyon

aldweb contre le SPAM

Pour avoir des nouvelles de ce site, inscrivez-vous à notre Newsletter.
Se désabonner
298 Abonnés
Sites web de la famille

Webmaster - Infos
News Amis


   visiteurs en ligne

Comment trouve-tu le nouvel habillage de l'aldweb Site ?
Superbe !
forum.gifForum - iziBasic - Sujet n°1169

Forum - Forum
iziBasic - iziBasic

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

actif  Sujet n° 1169  Feature Request for Text Fields

le 14/03/2005 @ 19:27
par 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!
Ecrire à Joshua Cook   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1
le 14/03/2005 @ 21:16
par 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!


Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2
le 15/03/2005 @ 12:53
par 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 :)
Ecrire à Khertan   Poster une réponse  Haut
actif sujet actif   clos sujet clos   Important! Important!   Nouveau Nouveau message   -   Rectifier Rectifier message   Clôturer Clôturer sujet   Remonter Remonter
Catégories de discussion  Forum 

^ Haut ^