Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Changes
Page history
Update to new event system
authored
Feb 20, 2022
by
Moritz Brückner
Show whitespace changes
Inline
Side-by-side
Getting-Started.md
View page @
11fe5873
...
...
@@ -61,9 +61,8 @@ package;
import
koui.Koui
;
import
koui.elements.
*
;
import
koui.events.EventHandler
;
import
koui.events.Events
;
import
koui.events.MouseEvent.MouseClickEvent
;
class
Main
{
public
static
function
main
()
{
...
...
@@ -76,11 +75,11 @@ class Main {
var
button
=
new
Button
(
"Click me!"
);
button
.
setPosition
(
400
,
180
);
button
.
onMouseClick
(
function
(
e
:
Event
)
{
switch
(
e
.
s
tate
)
{
case
Active
:
button
.
addEventListener
(
MouseClickEvent
,
(
e
:
MouseClick
Event
)
->
{
switch
(
e
.
getS
tate
()
)
{
case
ClickHold
:
button
.
label
=
"Clicking"
;
case
Deactivate
d
:
case
ClickEn
d
:
button
.
label
=
"Clicked"
;
default
:
button
.
label
=
"Click me!"
;
...
...
@@ -112,8 +111,7 @@ package arm;
import
koui.Koui
;
import
koui.elements.
*
;
import
koui.events.EventHandler
;
import
koui.events.Events
;
import
koui.events.MouseEvent.MouseClickEvent
;
class
KouiTrait
extends
iron
.
Trait
{
public
function
new
()
{
...
...
@@ -124,11 +122,11 @@ class KouiTrait extends iron.Trait {
var
button
=
new
Button
(
"Click me!"
);
button
.
setPosition
(
400
,
180
);
button
.
onMouseClick
(
function
(
e
:
Event
)
{
switch
(
e
.
s
tate
)
{
case
Active
:
button
.
addEventListener
(
MouseClickEvent
,
(
e
:
MouseClick
Event
)
->
{
switch
(
e
.
getS
tate
()
)
{
case
ClickHold
:
button
.
label
=
"Clicking"
;
case
Deactivate
d
:
case
ClickEn
d
:
button
.
label
=
"Clicked"
;
default
:
button
.
label
=
"Click me!"
;
...
...
...
...