New User Question 
Author Message
 New User Question

Very very new to RealBasic.. . so my apologies for the simplicity of
this question, as it may appear to some!

I've created the look and feel now I want a button, named 'button'
when clicked to access a database (text file or something?) of words
and display them randomly into the text 'display' window, what is the
action for this to happen that I have to put on the button?

thanks so much

p.



Mon, 17 Jan 2005 22:32:00 GMT  
 New User Question

Quote:

> Very very new to RealBasic.. . so my apologies for the simplicity of
> this question, as it may appear to some!

> I've created the look and feel now I want a button, named 'button'
> when clicked to access a database (text file or something?) of words
> and display them randomly into the text 'display' window, what is the
> action for this to happen that I have to put on the button?

> thanks so much

> p.

make an array with all the strings you want to use:

dim textarray(9) as string

this will make an array with 10 items (0-9)
then assign the item to whatever you want:

textarray(0)=blah
textarray(1)=dah
textarray(2)=bleh
etc.

to display the random text, use:

dim random as integer

random=round(rnd*9)

displayfield.text=textarray(i)

hope that helps
--
Markus Magnuson

"It is computed that eleven thousand persons have at several times suffered
death rather than submit to break eggs at the smaller end"



Tue, 18 Jan 2005 00:09:49 GMT  
 New User Question

Quote:
> make an array with all the strings you want to use:

> dim textarray(9) as string

> this will make an array with 10 items (0-9)

I think you mean "Dim textArray(10) As String". The number inside the
parenthesis determines how many items there are in the array, starting with
0.

Dave



Tue, 18 Jan 2005 02:58:56 GMT  
 New User Question
actually Marcus was right. The number of items that can be in an array is
determined by the number in the parenthesis + 1. Because 0 also counts as an
array number.


Quote:

>> make an array with all the strings you want to use:

>> dim textarray(9) as string

>> this will make an array with 10 items (0-9)

> I think you mean "Dim textArray(10) As String". The number inside the
> parenthesis determines how many items there are in the array, starting with
> 0.

> Dave

--
Remove SPAMSUCKS to reply to me


Tue, 18 Jan 2005 04:45:04 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Q: new user questions

2. Screen load order? -- New user question

3. New User Question

4. new user questions

5. New user questions

6. New User Question

7. New user question: py2exe with Pmw

8. New User Question: extension types and python 2.2/class/type

9. New user questions ... be gentle

10. New User Question

11. Basic new user questions

12. 2 Basic questions from a new user

 

 
Powered by phpBB® Forum Software