2 registered members (Ayumi, 1 invisible),
584
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
adding a string to a panel
#331513
07/04/10 19:17
07/04/10 19:17
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
Hello.
Im working in a interface where the user must type text into text boxs.
For these a create in runtime, a panel entity then add the digits apart, 5, 10, 20 etc..
IM using this: //define strings global STRING* contact_data1="empty"; STRING* contact_data2="empty"; STRING* contact_data3="empty";
function show_textbox(PANEL* p, int x , int y,STRING* a){ pan_setdigits(p,0,x,y,"%s",font_arialb_17,1,a); //a is the string passed on the previous called function
}
for adding the digit i use: int line_space=0;
line space+=17 +3; show_textbox(add_inputs_pan,0 ,line space,contact_data1);
line space+=17 +3; show_textbox(add_inputs_pan,0 ,line space,contact_data2);
line space+=17 +3; show_textbox(add_inputs_pan,0 ,line space,contact_data3);
The problem is the digit never appears..
Now i know i used this before on panelX=pan_create("..digits.. with the string pointer as last parameter...)
from the manual.. its said: pan_setdigits(PANEL*, var num, var x, var y, STRING* format, FONT* font, var factor, var* pv)
and pv must be a global var* pointer. Other parameter types are not accepted.
=== so: How do i solve this, ? Once i want to place the digits strings in specific locations, and not constrained to the TEXT* automatic space , between lines??
Last edited by MMike; 07/04/10 19:18.
|
|
|
Re: adding a string to a panel
[Re: Lukas]
#331523
07/04/10 20:40
07/04/10 20:40
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
1- Thanks LuKas. 2-Never had problems with the inkey on digits.. 3-Yes its for inchar! but not inchar directly...inchar adds the digits to the string. and the strings changes as a type, and the panel refresh the string contents, thats why its handy.
The problem with the string being the format, is that it wont refresh as a type! so thats "useless"..
TEXT entities, are not very friendly, because i dont like the spacing of the text ( im not able to control the space between lines) and it wont fit the space of the UI design i have )
Im sad,this things happens.
Dont understand the trouble, since i can use strings as var pointer when defining the panel with pan_create and CAn'T when, adding a new digits to the panel LOOl thats Weird.
my Solution is: Im going to have to use a draw_text in a while loop, sadly i wont be able to fade the text in, since draw text has no alpha parameter...
Last edited by MMike; 07/05/10 00:49. Reason: spelling errors .. and solution added.
|
|
|
Re: adding a string to a panel
[Re: MMike]
#331557
07/05/10 01:17
07/05/10 01:17
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
... The problem with the string being the format, is that it wont refresh as a type! so thats "useless".. ... Yes they will update, and they can be created this way dynamically. eg:
...
//add a new chunk of text to the panel dynamically
pan_setdigits(my_panel,0, 10,10, some_string, arial_font, NULL, NULL);
...
//change the contents of it...
str_cpy(some_string, "new content");
...
BUT, I cant see an easy way to use inkey with a digits panel.... But I'll keep thinking, I may come up with something...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: adding a string to a panel
[Re: EvilSOB]
#331558
07/05/10 01:21
07/05/10 01:21
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
i always used inkey with digits! thats not the problem.. because it can be done, if the panel is defined.. you just can add a digit that will behave that same way! but i posted the solution, i will use draw_text instead.. and Thanks, save your neurons for another hhahah no really your very kind.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|