File tree Expand file tree Collapse file tree
apps/app/ui-tests-app/events Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout" ;
2+ import { Button } from "tns-core-modules/ui/button" ;
3+ import { TextView } from "tns-core-modules/ui/text-view" ;
4+ import { View } from "tns-core-modules/ui/core/view" ;
5+ import { EventData } from "tns-core-modules/data/observable" ;
6+ let buttonsCount = 1 ;
7+
8+ export function onLayoutChanged ( args ) {
9+ let msg = "StackLayout layout changed - width:" + args . object . getActualSize ( ) . width ;
10+ ( < TextView > args . object . page . getViewById ( "output" ) ) . text += msg + "\n" ;
11+ }
12+
13+ export function addChild ( args ) {
14+ let button = new Button ( ) ;
15+ button . text = "Button" + buttonsCount ;
16+ button . margin = 10 ;
17+ button . backgroundColor = "lightgreen" ;
18+
19+ ( < StackLayout > args . object . page . getViewById ( "target" ) ) . addChild ( button ) ;
20+ buttonsCount ++ ;
21+ }
22+
23+ export function clear ( args ) {
24+ ( < StackLayout > args . object . page . getViewById ( "target" ) ) . removeChildren ( ) ;
25+ args . object . page . getViewById ( "output" ) . text = "" ;
26+ }
Original file line number Diff line number Diff line change 1+ <Page >
2+ <GridLayout rows =" *, *, *" >
3+ <StackLayout horizontalAlignment =" left" orientation =" horizontal" backgroundColor =" yellow" id =" target" margin =" 20" layoutChanged =" onLayoutChanged" />
4+
5+ <StackLayout row =" 1" >
6+ <Button text =" clear" tap =" clear" />
7+ <Button text =" add child" tap =" addChild" />
8+ </StackLayout >
9+ <TextView row =" 2" id =" output" automationText =" output" style =" font-size: 10, font-family: monospace;" />
10+ </GridLayout >
11+ </Page >
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export function loadExamples() {
1919 examples . set ( "i61" , "events/i61" ) ;
2020 examples . set ( "i73" , "events/i73" ) ;
2121 examples . set ( "i86" , "events/i86" ) ;
22+ examples . set ( "layout changed" , "events/layout-changed-event" ) ;
2223
2324 return examples ;
2425}
You can’t perform that action at this time.
0 commit comments