project: madlib
Your task is to make a madlib - a sort of interactive story. The program should ask for words by category, for example "Name of Woman" or "Adjective". Then the program should write a story (hopefully funny) using the provided words.
Project requirements
Your project should prompt the user for at least eight words. It should have at least two windows - one for word entry and one for the story, but it can have more. The story window should look good.
Strings
In the Calculator project we used the "integer" variable type. In the MadLib, you will need to learn about "strings". Strings are variables that hold text information. Numbers and punctuation are text too!. There is a big difference between the integer 7 and the string "7".
Adding Strings
To make a big string, you start like this
dim story as string
story = "A long time ago in a galaxy far, far away "
then, you can add to the string like this:
story = story + Window1.TextField2.text
and then
story = story + " travelled the galaxy in search of adventure."
If the text inside TextField2 inside Window1 has the name "Bob" in it, then the story string now contains "A long time ago in a galaxy far, far away Bob travelled the galaxy in search of adventure."
Lots of Windows
You can make a new window with the "File->New Window" menu command. Each window has a name. If you need to refer to a control or property of another window, you have to name the window. For instance, if you want to refer to the text of a textfield in Window1 while you are in Window2, you have to say
Window1.TextField1.text
You can open a window with
Window2.show
You can hide a window with
Window2.hide
You can close a window with
Window2.close
Be careful! If you close a window you can no longer access its properties and controls!
Doing more
This is an open ended project. You can add whatever you want! Try putting background images in widows. Try different fonts. What if you ask for a name and don't want people to use your name? You could write a little line of code
if NameField.text = "Mark" then
msgbox "Name rejected"
end
Grading Criteria
To receive a good grade, your project should work, your story should be well though out. Your textfields, buttons, and windows should be named appropriately. Your labels do not have to be named, unless you change their text in your code. Naming these objects makes your code easier to read! Your application should be built, and should have an icon. Comments should be used to explain your code in at least 3 places.