| 8 | namespace bdn |
| 9 | { |
| 10 | void KeyboardPage::init() |
| 11 | { |
| 12 | stylesheet = FlexJsonStringify({"flexGrow" : 1.0}); |
| 13 | |
| 14 | auto obscureCheckbox = std::make_shared<Checkbox>(); |
| 15 | addChildView(makeRow("Obscure", obscureCheckbox)); |
| 16 | |
| 17 | auto fields = { |
| 18 | std::make_pair("Text", TextInputType::Text), |
| 19 | std::make_pair("Number", TextInputType::Number), |
| 20 | std::make_pair("Phone number", TextInputType::Phone), |
| 21 | std::make_pair("EMail", TextInputType::EMail), |
| 22 | std::make_pair("URL", TextInputType::URL), |
| 23 | std::make_pair("Multiline", TextInputType::MultiLine), |
| 24 | std::make_pair("Date/Time", TextInputType::DateTime), |
| 25 | }; |
| 26 | |
| 27 | for (auto &field : fields) { |
| 28 | auto textField = std::make_shared<TextField>(); |
| 29 | textField->textInputType = field.second; |
| 30 | |
| 31 | textField->stylesheet = |
| 32 | FlexJsonStringify({"flexGrow" : 1, "maximimumSize" : {"width" : 250}, "margin" : {"right" : 10}}); |
| 33 | |
| 34 | textField->obscureInput.bind(obscureCheckbox->checked, BindMode::unidirectional); |
| 35 | |
| 36 | addChildView(makeRow(field.first, textField)); |
| 37 | } |
| 38 | |
| 39 | auto noAutoCorrect = std::make_shared<TextField>(); |
| 40 | noAutoCorrect->autocorrectionType = AutocorrectionType::No; |
| 41 | |
| 42 | noAutoCorrect->stylesheet = |
| 43 | FlexJsonStringify({"flexGrow" : 1, "maximimumSize" : {"width" : 250}, "margin" : {"right" : 10}}); |
| 44 | |
| 45 | noAutoCorrect->obscureInput.bind(obscureCheckbox->checked, BindMode::unidirectional); |
| 46 | addChildView(makeRow("No a/c", noAutoCorrect)); |
| 47 | } |
| 48 | } |