Resetting Array Data?

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!
Post Reply
Rocket Boy
Coder
Posts: 19
Joined: Thu Sep 08, 2005 3:14 am

Resetting Array Data?

Post by Rocket Boy »

Okay, I'm programming a GUI and I want to make a routine for closing a window that would reset all it's array data like it never existed. This way it could be taken the place of by a new window. How could I do this?
User avatar
matt2jones
Veteran
Posts: 80
Joined: Sat Feb 19, 2005 8:29 am
Location: elsewhere
Contact:

Post by matt2jones »

Try looking up ERASE or REDIM commands....

Failing that, do it by hand...

matt
Do not mistake Apathy for feeling Content.

http://www.disjointed.cjb.net - Short Storys
http://matt2jones.deviantart.com - Random Art
http://www.freewebs.com/matt2jones - WebComic
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

ERASE works wonders for static arrays but it destroys dynamic ones. The best idea is probably to clear the array manually.
Rocket Boy
Coder
Posts: 19
Joined: Thu Sep 08, 2005 3:14 am

Post by Rocket Boy »

You mean just setting all it's parts to 0?
User avatar
matt2jones
Veteran
Posts: 80
Joined: Sat Feb 19, 2005 8:29 am
Location: elsewhere
Contact:

Post by matt2jones »

Yup...

Or if your using a TYPE, it might be faster to poke through the whole array space in a loop... less typing...

matt
Do not mistake Apathy for feeling Content.

http://www.disjointed.cjb.net - Short Storys
http://matt2jones.deviantart.com - Random Art
http://www.freewebs.com/matt2jones - WebComic
Rocket Boy
Coder
Posts: 19
Joined: Thu Sep 08, 2005 3:14 am

Post by Rocket Boy »

Cool. On a not totaly related note, but probably not worth starting another thread over... I have some code for inputting text into a window that basically goes

<sort-of pseudo code>
do
a$ = INKEY$
font routine, a$, x, y, ect...
loop until the user clicks something else
</sort-of pseudo code>

Now, if I dont have any text boxes selected but I just type a bunch of crap in... it will end up going into the next text box I select, why is that? I dont want any key hits that happen when no text box is selected to go into anything.
Post Reply