Monday, March 10, 2014

Step 6

Week  6 (March 5-12) — Widgets

To deliver:

  • Create pop-up boxes for text

This week's summary:

What I learned:

I've always been a little bit confused about what widgets are and I think I'm beginning to understand.  If I'm understanding right, it's something that tells the app to do some little command.  I already created a scroll view, but now I've got to create a menu button!  I also learned a little more about functions.

If I'm understanding correctly, a function is set up to give the app a little bit of instructions.  The function is given a name, and any time that the function's name is given, it uses the instructions to perform the function.  Here is an illustration in a photo:

I'm still experimenting a little with what I can do with these babies, but I can see how understanding functions is key to creating apps.

Examples of code:

function m:makeDialogBox() local dialogBoxWithText = display.newGroup() local dialogBox = display.newRect( 0, 0, 200, 100) dialogBox:setStrokeColor (1,0,0) dialogBox.strokeWidth = 3 dialogBox:setFillColor(.85,.85,.85)
local keyWord = display.newText("Test word", 20, 40, "Georgia", 22) local definition = display.newText("Test definition this is a definition that is really long", 30, 50, 150, 0, "Georgia", 22)
dialogBoxWithText:insert(dialogBox) dialogBoxWithText:insert(keyWord) dialogBoxWithText:insert(definition)

return dialogBoxWithText
end



Some great resources:


  • http://docs.coronalabs.com/api/type/DisplayObject/removeSelf.html
  • http://docs.coronalabs.com/api/type/GroupObject/remove.html
  • https://docs.coronalabs.com/api/type/ButtonWidget/index.html
  • https://docs.coronalabs.com/api/library/widget/newTabBar.html
  • https://docs.coronalabs.com/api/type/TextBox/index.html

Questions/concerns/problems to come back to:


  • How can I make the objects within the "create scene" phase accessable outside of that scene?
  • How do I remove something that I've displayed?

Functioning code so far:

https://drive.google.com/folderview?id=0B406rJ0oHVzZbDc1WW1kNVJKbm8&usp=sharing

No comments:

Post a Comment