Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 584 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
adding a string to a panel #331513
07/04/10 19:17
07/04/10 19:17
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline 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: MMike] #331516
07/04/10 19:33
07/04/10 19:33
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
The only way to show "just" a text in digits is using the format string as text. However, if you plan to make textboxes using inkey(), I recommend to use texts for that because jcl once that somewhere that digits where never meant to be used by inkey and might misbehave if you do so.

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 Offline OP
Serious User
MMike  Offline 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 Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Originally Posted By: MMike
...
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:
Code:
...  
     //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 Offline OP
Serious User
MMike  Offline 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 tongue no really your very kind.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1