Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Akow, tomaslolo), 1,536 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
input textbox and submit button #150620
08/28/07 02:43
08/28/07 02:43
Joined: Jun 2007
Posts: 28
D
Doriel Offline OP
Newbie
Doriel  Offline OP
Newbie
D

Joined: Jun 2007
Posts: 28
Hello,

I am trying to create a login feature for my game. The user would type in a userid and password and then click a button. I understand how to create a button and how to handle the click event. But how do I create a textbox? Is there an easy way to do this or do I have to create my own images, check if the mouse is over the textbox and then catch the keystroke events and populate a string and show it in the textbox? Seems like a lot of work...

Please let me know.

Regards,

Doriel

Re: input textbox and submit button [Re: Doriel] #150621
08/28/07 06:22
08/28/07 06:22
Joined: Jul 2006
Posts: 503
Australia
A
adoado Offline

User
adoado  Offline

User
A

Joined: Jul 2006
Posts: 503
Australia
Use Inkey - it acts like a textbox. In the manual lookup "Inkey" and it will have all the help you need Or this may help:

String EntryString;
..

Text DisplayText
{
Pos_X = 5;
Pos_Y = 5;
Layer = 1;
String = EntryString;
}

Then in the appropiate spot add (and make the TEXT visible also):

Inkey(EntryString); // wait until [enter] pressed
if (result == 13)
{
//Do something here
}

It is NOT tested but hopefully works

Adoado.


Visit our development blog: http://yellloh.com
Re: input textbox and submit button [Re: adoado] #150622
08/30/07 17:10
08/30/07 17:10
Joined: Jun 2007
Posts: 28
D
Doriel Offline OP
Newbie
Doriel  Offline OP
Newbie
D

Joined: Jun 2007
Posts: 28
Ok. I have two textboxes and am able to get input from the keyboard using the inkey function. However, I have a slight problem. If the user clicks on a textbox (i have a button that triggers a function), I call the inkey function to start the input. If the user clicks on the textbox again, the program crashes because inkey is already active. So what I tried doing is first deactivating the input and then starting it up again by using the following:

inkey_active = off;

However, I am noticing that this isn't working properly. Did anyone else have this problem? According to the manual and the code I've seen, it should work.

Re: input textbox and submit button [Re: Doriel] #150623
08/30/07 17:53
08/30/07 17:53
Joined: Oct 2006
Posts: 873
S
Shadow969 Offline
User
Shadow969  Offline
User
S

Joined: Oct 2006
Posts: 873
inkey_active works for me.
But in your case i think it's better not to do anything if the inkey is already active

Re: input textbox and submit button [Re: Shadow969] #150624
08/30/07 18:01
08/30/07 18:01
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Try this (had worked for me)

if(inkey_active==1)
{
inkey_active=0;
wait(1);
}
...

Regards
TSGames

Re: input textbox and submit button [Re: TSG_Torsten] #150625
08/30/07 22:35
08/30/07 22:35
Joined: Jun 2007
Posts: 28
D
Doriel Offline OP
Newbie
Doriel  Offline OP
Newbie
D

Joined: Jun 2007
Posts: 28
Alright. I tried everything and still not working. It keeps crashing. Here is a code snippet. What am I missing?




string userid = "123456789123"; // max length of 12
string password = "123456789123"; // max length of 12

FONT login_font = "Verdana", 2, 18;

TEXT userid_txt
{
Pos_x = 480;
Pos_y = 363;
layer = 6;
red = 0;
green = 0;
blue = 0;
font = login_font;
String = userid;
}

TEXT password_txt
{
Pos_x = 480;
Pos_y = 388;
layer = 6;
red = 0;
green = 0;
blue = 0;
font = login_font;
String = password;
}

function enterUserName()
{
if(inkey_active == 1)
{
inkey_active = 0;
}
userid_txt.visible = ON;
Inkey(userid);
}


function enterPassword()
{
if(inkey_active == 1)
{
inkey_active = 0;
}
password_txt.visible = ON;
Inkey(password);
}

Panel start_pan
{
bmap = "Login.bmp";
button(475, 363, "Textbox.bmp", "Textbox.bmp", "Textbox.bmp", enterUserName, NULL, NULL);
button(475, 388, "Textbox.bmp", "Textbox.bmp", "Textbox.bmp", enterPassword, NULL, NULL);
layer = 5;
flags = VISIBLE, OVERLAY;
}


The goal is to have two textboxes (buttons) and when you click on one, it will start the input. When the user clicks on the other one, the input will be for that string. Got it?

Please try it and let me know what i'm doing wrong. The thing that's happening is for me is that after I click on the first textbox and enter a string and then click on the second one, I see two blinking bars, one for each textbox. However, when I type, it's still going to the first string. And as soon as I click ESC or TAB, the program just freezes and I have to reboot my pc.


Thanks in advance,

Doriel

Re: input textbox and submit button [Re: Doriel] #150626
08/30/07 23:22
08/30/07 23:22
Joined: Jun 2007
Posts: 28
D
Doriel Offline OP
Newbie
Doriel  Offline OP
Newbie
D

Joined: Jun 2007
Posts: 28
Ah, I got it. I was missing the wait(1); after the inkey_active=0; line. Makes a world of difference. It works now!

Thanks guys!


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