code_uifontdescription.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // UIFontdescription application source code
  2. 'use strict';
  3. var utils = require("Scripts/utils");
  4. exports.init = function(mylayout,mylogger) {
  5. //
  6. // action functions
  7. //
  8. var steps = mylayout.getWidget("fontstep");
  9. steps.onChanged = function(ev) {
  10. var mytext = mylayout.getWidget("changetext");
  11. var myfont = new Atomic.UIFontDescription();
  12. myfont.setSize(Math.round (steps.value));
  13. myfont.setId("Vera");
  14. mytext.setFontDescription (myfont);
  15. mytext.setText ( "Size " + String (Math.round (steps.value) ));
  16. mylogger.setText( "UIFontdescription action : " + steps.id + " step size changed to " + String (steps.value));
  17. };
  18. //
  19. // support functions
  20. //
  21. var button5 = mylayout.getWidget("uifontdescriptioncode");
  22. button5.onClick = function () {
  23. mylogger.setText( "UIFontdescription support : " + button5.id + " was pressed ");
  24. utils.viewCode ( "Components/code_uifontdescription.js", mylayout );
  25. };
  26. var button6 = mylayout.getWidget("uifontdescriptionlayout");
  27. button6.onClick = function () {
  28. mylogger.setText( "UIFontdescription support : " + button6.id + " was pressed ");
  29. utils.viewCode ( "Scenes/layout_uifontdescription.ui.txt", mylayout );
  30. };
  31. };