Thread Rating:
  • 281 Vote(s) - 2.62 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Page 3: Using Different Events
06-16-2011, 03:25 PM, (This post was last modified: 06-23-2011, 04:00 PM by ashimo.)
#1
Page 3: Using Different Events
Using Different Events


In the previous section, we processed events related to command buttons and check buttons. Next, let’s consider events that are not related to controls.


Create the 'Try 2-2' Project

Close the Try 2-1 project and then, from the IDE “File” menu, select “New Project.” In the "New Project" dialog box, select "Applet Project" (1), input "Try2-2" (2), specify c:\Curl\lesson\Try2\02_event in the “Directory” field (3), set the "API Version" to "6.0" (4), and then click "OK" (5).



Inputting the Program

Next, we’ll input the following program code. Or, if you prefer, you can copy the program from c:\Curl\Try2\02_event\start.curl and then paste it into the editor.

Code:
{Frame
    height = 5cm,
    width = 5cm,
    margin = 1cm,
    background = orange,
    {Frame
        height = 3cm,
        width = 3cm,
        background = pink,
        {on e:PointerPress at f:Frame do
            set f.background = #00FF00
            {e.consume}
        },
        {on e:PointerRelease at f:Frame do
            set f.background = pink
            {e.consume}
        }
    },
    {on e:PointerPress at f:Frame do
        set f.background = #FF0000
        {e.consume}
    },
    {on e:PointerRelease at f:Frame do
        set f.background = orange
        {e.consume}
    }
}

Save the File, and then Execute the Program

After inputting the code, save the file, and then execute the program. As a result, your browser will display an orange-colored Frame, inside of which is a pink Frame. If we click the inside Frame, its color changes from pink to lime-green. And, if we click the outside Frame, it changes from orange to red.



Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Page 8: Extra Practice ashimo 0 3,475 06-16-2011, 04:05 PM
Last Post: ashimo
  Page 7: Summary ashimo 0 2,963 06-16-2011, 03:57 PM
Last Post: ashimo
  Page 6: Let’s look at the make-up of this game ashimo 0 3,173 06-16-2011, 03:50 PM
Last Post: ashimo
  Page 5: Application... A “Push the Button in 10s” Game ashimo 0 3,131 06-16-2011, 03:33 PM
Last Post: ashimo
  Page 4: Structure of our program that uses events ashimo 0 2,820 06-16-2011, 03:30 PM
Last Post: ashimo
  Page 2: Structure of a Program that Displays Values input from Controls ashimo 0 2,923 06-16-2011, 02:18 PM
Last Post: ashimo
  Page 1: Making a Simple Action Game ashimo 0 2,727 06-16-2011, 02:03 PM
Last Post: ashimo
Forum Jump:


Users browsing this thread:
1 Guest(s)