Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Pleae need help <deadline>

Author
Message
Hopeless Programmer
20
Years of Service
User Offline
Joined: 11th Jun 2004
Location:
Posted: 11th Jun 2004 15:44 Edited at: 11th Jun 2004 16:02
I know this is trivial but I really need to know. I need to make a button, but I also need the rest of the program to run as well with "Inputs" and other stuff. Sor really what I am asking is how do you make two scripts run at the same time? Thanks
I've got a deadline in like 2 days, please!
<You all look at this post but don't reply? Why! I need help>
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 11th Jun 2004 18:20
Well actually, you don't... You use a process called "polling."

What I mean is, you check for mouse input then keyboard input, then back to mouse and back to keyboard, etc. If you're also using a joystick you do the same thing, shifting between all three.

How you manage input from the keyboard is normally done thru INKEY$() which returns a string of any key being pressed. If the value is "" (empty) then you go back to checking the joystick or mouse. If it is not, you put the result into a string variable and go back for the next key, adding it to the string and so on....

It's a bother at first I know, but fairly normal for BASIC programs.
S.

Any truly great code should be indisguishable from magic.
Hopeless Programmer
20
Years of Service
User Offline
Joined: 11th Jun 2004
Location:
Posted: 12th Jun 2004 05:02
But what if i want to do an
Input command? As well as a loop?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Jun 2004 15:22
You can't.

As SandraD said, you'll need to check the INKEY$() function for key presses and add them to a string to build up the input.

Alternatively, you can check out the ENTRY$() function and the CLEAR ENTRY BUFFER command.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 13th Jun 2004 07:03 Edited at: 13th Jun 2004 10:18
Hi again...

I created this little piece of code to show how it "usually" done, using the example of Mizipzor's encryption program as the basis. So here goes;



That is pretty much "routine" for most Basic programs, a constant loop to switch between different devices. The encryption string is the same as an input prompt, and you have the option of echoing the keys back to the user, editing for backspace, and so on.

Good luck!
S.


[edit: oops! I forgot some REM commands... it's correct now.]

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2024-11-26 20:15:31
Your offset time is: 2024-11-26 20:15:31