2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
digits string format align number
#330996
07/01/10 14:22
07/01/10 14:22
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
hello im trying to figure out , how to align this string digits(-100,15,\"%-5.f Messages \",font_arial_14,1,stat_2); what i want it so show:
ex: 20 messages
100 messages
10000 messages
and not
20 messages
100 messages
10000 messages
what is the format to align the number to the left side, and then the trail message string. From the manual a tried the flag -, and the width of 5 as you see, but.. it is not working.. because when the number increase the message text will move to the right. thanks
Last edited by MMike; 07/01/10 14:22.
|
|
|
Re: digits string format align number
[Re: Lukas]
#331007
07/01/10 14:55
07/01/10 14:55
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
First , thanks.
I asked that feature longe ago on the future section, to let panels be left aligned too...
Last edited by MMike; 07/01/10 18:11.
|
|
|
Re: digits string format align number
[Re: MMike]
#331048
07/01/10 18:12
07/01/10 18:12
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
Please somebody help me, what does this : "[text1]%[flags][width][.precision]f[text2]" from digits...
if [flags] = Optional one or more of the following characters: - = Left align the number within the given field width. Default: Right align."
how i use the "-" thing? i have this: digits(-90,26,\"%-5.fMessages\",font_arial_14,1,stat_2); digits(-90,37\"%0.f Notifications\",font_arial_14,1,stat_2);
and they display the same text in the same way, and position, so its not working i assume?
|
|
|
Re: digits string format align number
[Re: MMike]
#331524
07/04/10 20:43
07/04/10 20:43
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
Anyone Come on!
How i use the alignemnt? i see no differences on using the "-" flag? Thanks.
Last edited by MMike; 07/04/10 20:43.
|
|
|
Re: digits string format align number
[Re: MMike]
#331538
07/04/10 22:08
07/04/10 22:08
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Works fine for me... As a test, try changing the font to courier, so you can see the spacing more clearly. Heres a sample panel...
PANEL* test =
{
pos_x=20; pos_y=20; size_x=200; size_y=120; flags= SHOW;
digits(10,10, "12345678901234567890", "Courier#18b", 0, 0);
digits(10,30, "%.0f and some text", "Courier#18b", 1, 10);
digits(10,50, "%5.0f and some text", "Courier#18b", 1, 10);
digits(10,70, "%-5.0f and some text", "Courier#18b", 1, 10);
}
Looks ugly as hell, but you can see it working. Remember, arial is a "proportional" font. Different characters have different 'widths". ie a 'space' character is narrow compared to a 'W'.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: digits string format align number
[Re: MMike]
#332574
07/10/10 20:24
07/10/10 20:24
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
okay i just think i found a bug.. thats why it did not work. i was using arial var stat_2; and create a panel with this:
PANEL* test =
{
pos_x=20; pos_y=20; size_x=200; size_y=120; flags= SHOW;
digits(90,37,\"%5.0f Messages\",Arial#18b,1,stat_2);
digits(90,56,\"%5.0f Messages\",Courier#18b,1,stat_2);
layer=7;
}
then on the console change stat_2=1; then 10; then 100 and they will act very very different... See why i was confused? Also times font wont work!? (evil, you, told about the space thing, but thats not even stated on the manual is it? and.. the feature says it for aligment.... nothing to do with the text being courier.. i mean, thats not logical! And im not using spaces, just numbers. the manual is clear " TrueType or bitmap character set for the display. Either a predefined FONT, or A6.6 a font filename or Truetype font name with size and style (like "Arial#24bi") can be given. If '*' ist given, the engine standard font is used." The font could be defined with : FONT* ac1="Arial#18b"; FONT* ac2="Courier#18b"; but also it wont work! they mess up the alignment... I will have to postpone the text ui part of the project, because of this issue.
Last edited by MMike; 07/10/10 20:36.
|
|
|
Re: digits string format align number
[Re: MMike]
#332603
07/11/10 02:50
07/11/10 02:50
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
OK, I dont have have access to A7 ATM, on holidays. So Im helping eather 'blind' at this time. But I'll do my best... Q1> and they will act very very different... See why i was confused? No, without A7 I cant. What do you mean? FYI The example you given is bad, shouldnt even compile. Is it badly typo'ed?
PANEL* test =
{
pos_x=20; pos_y=20; size_x=200; size_y=120; flags= SHOW;
digits(90,37,"%5.0f Messages","Arial#18b",1,stat_2);
digits(90,56,"%5.0f Messages","Courier#18b",1,stat_2);
layer=7;
}
Q2> Also times font wont work!? ... Probable not. Its not mentioned in the manual cause its assumed you are already aware. Its a windows thing. Open the "fonts" folder in c:\windows and look at the list. If the icon is an 'O' or a 'TT' then this spacing issue will be a problem with that font. (proportional) If the icon is an 'A' it will space the way you want. "non-propertional" Problem is, all those fonts look ugly and retro... Try using bitmap fonts instead.... Q2a> I know you are using numbers, but when you are using the alignment specs, "the engine" uses spaces to set the aligmnment how you ask. Thats when the "narrow" spaces some fonts have make a mess of any text that comes after the number. The best way would be to have the number as a separate 'digit' to the text. ie...
PANEL* test =
{
pos_x=20; pos_y=20; size_x=200; size_y=120; flags= SHOW;
digits(90,37,"%5.0f","Arial#18b",1,stat_2);
digits(100,37,"Messages","Arial#18b",0,0);
digits(90,56,"%5.0f","Courier#18b",1,stat_2);
digits(100,56,"Messages","Courier#18b",0,0);
layer=7;
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|