MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / createPage

Function createPage

apps/automated/src/pages/page12.ts:6–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import * as gridLayoutModule from '@nativescript/core/ui/layouts/grid-layout';
5
6export function createPage() {
7 var page = new pages.Page();
8 var gridLayout = new gridLayoutModule.GridLayout();
9
10 var lengths = [new gridLayoutModule.ItemSpec(140, 'pixel'), new gridLayoutModule.ItemSpec(1, 'star'), new gridLayoutModule.ItemSpec(140, 'pixel')];
11
12 var rows = 2;
13 var cols = 3;
14 var row;
15 var col;
16
17 for (row = 0; row < rows; row++) {
18 var rowDef = new gridLayoutModule.ItemSpec(1, 'auto');
19 gridLayout.addRow(rowDef);
20 }
21
22 for (col = 0; col < cols; col++) {
23 gridLayout.addColumn(lengths[col]);
24 }
25
26 var btn = new btns.Button();
27 btn.text = 'Col: 0';
28 gridLayoutModule.GridLayout.setColumn(btn, 0);
29 gridLayoutModule.GridLayout.setRow(btn, 0);
30 gridLayout.addChild(btn);
31
32 var btn2 = new btns.Button();
33 btn2.text = 'Col: 2';
34 gridLayoutModule.GridLayout.setColumn(btn2, 2);
35 gridLayoutModule.GridLayout.setRow(btn2, 0);
36 gridLayout.addChild(btn2);
37
38 var txt = new tb.TextField();
39 txt.text = 'Col: 1';
40 txt.width = 140;
41 gridLayoutModule.GridLayout.setColumn(txt, 1);
42 gridLayoutModule.GridLayout.setRow(txt, 0);
43 gridLayout.addChild(txt);
44
45 var txt2 = new tb.TextField();
46 txt2.text = 'Col: All';
47 gridLayoutModule.GridLayout.setColumnSpan(txt2, 3);
48 gridLayoutModule.GridLayout.setRow(txt2, 1);
49 gridLayout.addChild(txt2);
50
51 page.content = gridLayout;
52
53 return page;
54}

Callers

nothing calls this directly

Calls 6

addRowMethod · 0.95
addColumnMethod · 0.95
setColumnMethod · 0.45
setRowMethod · 0.45
addChildMethod · 0.45
setColumnSpanMethod · 0.45

Tested by

no test coverage detected