Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
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 (7th_zorro, dr_panther), 724 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
How am i able to let the User write a Text? (look last post ) #233780
10/30/08 16:58
10/30/08 16:58
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Hi..

I´m a bit confues with that..

i tried

inkey(Karten_name)

Karten_name is a String that is shown in a visible Panel too ( to show the text the user is writing ).
But there´s no reaction.

How am i able to let the user write?
And how am i able to limit the input for each string ( karten_name shoudn´t be larger than 17 Signs )?

Last edited by xXReapeRXx; 10/31/08 11:49.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: How am i able to let the User write a Text? [Re: Espér] #233802
10/30/08 18:34
10/30/08 18:34
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
You have to show your string in a TEXT* instead of digits in a PANEL*.

How to limit the string length:
str_cpy(Karten_name,"#17"); // Karten_name consists of 17 spaces now.
inkey(Karten_name);

wink

Re: How am i able to let the User write a Text? [Re: Lukas] #233807
10/30/08 19:22
10/30/08 19:22
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
uhm.. i´m showing the name with that:

Code:
TEXT* namensfeld  =
{pos_x=21;pos_y=350;layer=20;font = goth;string(Karten_name);flags=VISIBLE;}


Looks like a Text.. not like a panel.. sry if i said wrong..

but, the String isn´t shown...


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: How am i able to let the User write a Text? [Re: Espér] #233811
10/30/08 20:02
10/30/08 20:02
Joined: Sep 2008
Posts: 66
falagar8 Offline
Junior Member
falagar8  Offline
Junior Member

Joined: Sep 2008
Posts: 66

this may help you and others.
Or at least, start you off.....


//set up a TEXT object...
//with some text to input/display

#include<acknex.h>
#include<default.c>

STRING* temp1="#50";


//added another TEXT Object
//to ask for user for text input:
//TEXT object sg


TEXT* sg={ pos_x=50; pos_y=10; font="Arial#24"; alpha=90; string("Enter text: "); flags=TRANSLUCENT | VISIBLE; }

TEXT* sg1={ pos_x=100; pos_y=35; font="Arial#24"; alpha=90; string(temp1); flags=TRANSLUCENT | VISIBLE; }




function main()
{
video_mode=7;
screen_color.blue=255;


wait(2);



//place inputted text into string of temp1

inkey(temp1);




while(1)
{


if(key_c)
{
sg1.red=0;
sg1.green=0;
sg1.blue=0; }

if(key_d)
{
sg1.red=255;
sg1.green=255;
sg1.blue=255; }



wait(1);


}






}

Re: How am i able to let the User write a Text? [Re: Espér] #233813
10/30/08 20:04
10/30/08 20:04
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Please show us your complete code, i.e. String definition and the inkey use. Otherwise we can just do lucky guesses.


Always learn from history, to be sure you make the same mistakes again...
Re: How am i able to let the User write a Text? [Re: Uhrwerk] #233817
10/30/08 20:09
10/30/08 20:09
Joined: Sep 2008
Posts: 66
falagar8 Offline
Junior Member
falagar8  Offline
Junior Member

Joined: Sep 2008
Posts: 66
use the inkey(string*) to input,edit,backspace
your string that you are inputting. It is shown
on the screen while you are inputting or editing. But in this case only up to 50 chars or characters.
Since STRING* temp1; is a undefined string of up to 50 characters.

Good inputting wink

one more thing:

in the code that I posted...
the string(temp1) method attaches the STRING* temp1 to the Text object sg1.
this is solely diffrent if you omit this string() method.
and then use something like:

str_cpy(temp1, "STARGATE SG1");
str_cpy( (sg1.pstring)[0], temp1);

you are just copying the string contained in temp1 to the pstring
contents of the TEXT object sg1.
While if you attach temp1 thru the string(temp1) method
it will be attached to the TEXT object rather than the string being copied.
And in this case with temp1 being attached and inputted with inkey will show up and displayed on the screen while its being edited/inputted. Hence its attached to the Text object of sg1.

Get it? smile
Do you follow?


Last edited by falagar8; 10/30/08 20:25.
Re: How am i able to let the User write a Text? [Re: falagar8] #233952
10/31/08 11:09
10/31/08 11:09
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Quote:
Get it? smile
Do you follow?

not really XD

but here are the code parts:

To define the String:
Code:
STRING* Karten_name = "#17";

To write a text into it:
Code:
function feldhandel()
{
	while(1)
	{
		if(textfeldnummer == 1)
		{
			inkey(Karten_name);
		}
		wait(1);
	}
}


textfeldnummer is a variable that is set to the number of the textfield you clicked on.

Here a Screen of the Editor:


The name field is declared with "Name der Karte". If i click with the mouse on it, textfeldnummer is set to 1.

Last edited by xXReapeRXx; 10/31/08 11:09.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: How am i able to let the User write a Text? [Re: Espér] #233956
10/31/08 11:41
10/31/08 11:41

F
Fear411
Unregistered
Fear411
Unregistered
F



you have to display the String with a Text Object.

Re: How am i able to let the User write a Text? [Re: ] #233957
10/31/08 11:45
10/31/08 11:45
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
i quote myself ( 5 post above ):
Quote:

uhm.. i´m showing the name with that:

Code:
TEXT* namensfeld =
{pos_x=21;pos_y=350;layer=20;font = goth;string(Karten_name);flags=VISIBLE;}



Looks like a Text.. not like a panel.. sry if i said wrong..

but, the String isn´t shown...


Like you see.. i show it with a text object..


EDIT:
Ok found out the problem.. the Message Boxes are white.. the text, too..
How am i able to change the text-color?

Last edited by xXReapeRXx; 10/31/08 11:49.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: How am i able to let the User write a Text? [Re: Espér] #233958
10/31/08 11:53
10/31/08 11:53

F
Fear411
Unregistered
Fear411
Unregistered
F



Maybe you didn't called the function feldhandle.


test it:

www.extremegames-online.de/showimages/test.c

this is the code:
Code:

STRING* Karten_name = "#17";

var textfeldnummer = 1;

void feldhandle()
{
	while(1)
	{
		if(textfeldnummer == 1)
		{
			inkey(Karten_name);
			if(result == 13)   // pressing enter
			{ 
			textfeldnummer = 0;
			} 
		}
		wait(1);
	}
}

TEXT* namensfeld =
{
	pos_x=21;
	pos_y=350;
	layer=20;
	font = _a4font;
	string(Karten_name);
	flags=VISIBLE;
}


void main()
{
	level_load("");
	feldhandle();
}


Page 1 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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