Page 1 of 1

Complete Lessons pdf - Exercise 1 - Page 18 suggestions

Posted: Sun Jul 26, 2020 4:54 pm
by Brother Bill
The book "Complete Lessons" for Exercise 1 on page 18 leaves out a lot of steps for the the newbee LiveCode developer.

After I get stuck trying to get Example 1 to work, I did a bit of research, and came up with the following steps that do work,
and also included a 9 minute handy video that exercises this.

Please consider updating the Complete Lessons book.
And you may share the video located at ... e%2018.mp4

Code: Select all

Example 1: Create example
0. View | Backdrop 
    a. This hides other applications on the main screen.
1. File | New Stack | Default Size
2. Object | Stack Inspector
    a. Name: Example 1 Stack
    b. Close
    c. File | Save
         i. Save to: C:\dev\livecode\LearningCurve\Page 18\Example 1 Stack.livecode
         ii. Your location may be different.
         iii. Click Save
3. Drag and resize Scrolling field to fill most, but not all, of default Card.  
    a. Name: log
    b. Close
4. Drag button below log
    a. Name: btnClear
    b. Label: Clear
    c. Close
5. Right click on Clear button, Edit Script
    a. In left pane, click mouseUp
    b. Enter:
	on mouseUp pButtonNumber
	   put empty into field "log"
	end mouseUp
    c. Click Apply or Control + Enter
6. Test btnClear Button
    a. In Tools palette, click on Browse Tool (Arrow cursor)
    b. Type in some text into field "log", then click on Clear button
    c. In Tools palette, click on Pointer Tool (right of Arrow cursor)
7. Drag another button to bottom center.
    a. Name: btnTestMessage
    b. Label: Test Message
    c. Close
    d. Widen button to have some "air".
8. Make btnTestMessage into a group.
    a. Select btnTestMessage
    b. Click Group Button in Menu Bar icon list
    c. Right click inside group | Property Inspector
    d. Name: grpTestMessage
    e. Label: Test Message Group
    f. [x] Show name
    g. [x] Show border
    h. Border width: 3
    i. Stretch Message box bounding rectangle to show all of group label
    j. To center Test Message
          i. Click Edit Group
          ii. In left pane, click on mouseUp, and enter
	on mouseUp
	   put the name of me && "received the mouseUp message" & return after field "log"
	end mouseUp
          iii. Click Apply or Control + Enter
          iv. Click Stop Editing
          v. Stretch Message box bounding rectangle to show all of group label
          vi. Click Apply button to activate script
9. Test it
    a. Click on Browse tool it Tools palette
    b. Click on Test Message button a few times
    c. Click on Clear button
10. Save
    a. Examine in file system
Explanation for C family developers:
on mouseUp is an event where when the mouse is clicked or enter is typed in.
put <something> after field "log"
1. evaluates something as text, and appends it after the existing text in field named log.
2. evaluates the name of me -- me is the object that sent the event message, in this case, the button
3. name of me is the name of the button: button "my_first_button"
4. && concatenates the next item, with a space added between them.

So in short, here is a long English explanation of what the script does:
When the user clicks my button, or presses enter for default button, or button has focus,
then get the name of that button (me) "button \"my_first_button\"" and append that after the contents of field "log".

Re: Complete Lessons pdf - Exercise 1 - Page 18 suggestions

Posted: Mon Jul 27, 2020 5:58 pm
by jiml

Thanks for our effort in making that clear explanation and video.

Jim Lambert

Re: Complete Lessons pdf - Exercise 1 - Page 18 suggestions

Posted: Wed Jul 29, 2020 1:47 pm
by Brother Bill
The Complete Lessons book has a strange order.
Consider putting "Hello World" much closer to the front of the book, after initial orientation.