CREATING CROSS-PLATFORM APPLICATIONS WITH THE WOLFRAM LANGUAGE:
CBM EXAMPLE

Gerli Jõgeva
Wolfram Research
Computer-Based Maths

Join the Conversation #WolframTechConf

CBM

...stands for Computer-Based Maths*

Principles:

use computer to do the calculating, student to do the thinking

more like real-life maths

* We’re British

Demo of existing materials

Installing the materials

Mathematica or CDF player must be pre-installed

Linux

.sh file

creates .desktop file in /usr/share/applications

Mac

.dmg file

creates alias on desktop

Windows

.msi file

creates Start menu shortcut

File layout

Files are organised as an add-on application

FindFile["CBM`"]

({{}, {}, {}, {}, {}, {"AmINormal.m"}, {"AreGirlsBetterAtMaths.m"}, {"CauseOrCorrelation.m"}, {"CBMConfiguration.m"}, {"CollaborationClient.m"}, {"Common.m"}, {".CreationID"}, {"DoIKnowWhatIDontKnow.m"}, {"HowCanIConvinceYou.m"}, {"..."}})

Why?

Easy to locate and load necessary code files

<<CBM`AmINormal`

dateToDays["01-01-1970"]

No dynamic content warnings since on trusted path ($BaseDirectory/Applications)

Bonus: creates item in Palettes menu

Welcome screen

<<CBMAuthorTools`

CBMAuthorTools`Private`welcomeNotebook[{},True]//CreateDocument

Designed to hide the fact it is a notebook.

Notebook options

CreateDocument[
Notebook[
{Cell[BoxData[ToBoxes[contents]]]},
WindowTitle->"My application",
WindowFrame->"ModelessDialog",
WindowElements->{},
ShowCellBracket->False,
Saveable->False,
Deployed->True,
WindowSize->{600,480}
]
];

Possible contents

contents=
Grid[
{{"Name",InputField[]},
{"Password",InputField["",String,FieldMasked->True]}},
BaseStyle->{"Text",ShowStringCharacters->False}]

contents=TabView[Range[10]]

Modules

Button["Open author notebook",
NotebookOpen["/home/gerlij/workspace/cbm/Content/Statistics/Modules/AreGirlsBetterAtMaths/AreGirlsBetterAtMaths.English.nb"],
FrameMargins->10]

Button["Open built notebook",
NotebookOpen["/usr/share/Mathematica/Applications/CBM/Content/English/AreGirlsBetterAtMaths.Teacher.cdf"],
FrameMargins->10]

Unifying the display of control types

Checkboxes

Current

Checkbox[]

Comparison:

New

something builtin...

Style[Checkbox[],ControlsRendering->"Generic"]

...or something custom

Checkbox2[Dynamic[value_]]:=
Toggler[Dynamic[value],{False->,True->}]

Checkbox2[Dynamic[value]]

Input fields

Current

InputField[]

Comparison:

New basic

InputField2[]:=
Framed[
InputField["",String,Appearance->"Frameless"],
FrameStyle->Gray]

InputField2[]

New fancy

InputField2[Dynamic[x_],type_,validate_:(True&)]:=
Framed[
InputField[Dynamic[x],type,
Appearance->"Frameless",
BaseStyle->"Text",
ContinuousAction->True],
FrameStyle->Dynamic[If[validate[x],Gray,Red]]]

InputField2[Dynamic[string1],String]

string2="";
InputField2[Dynamic[string2],String,(StringLength[#]>6&)]

TabView

Current

TabView[{"Tab 1"->"Contents 1","Tab 2"->"Contents 2","Tab 3"->"Contents 3"}]

Comparison:

New fancy

<<CBM`

TabView2[{"Tab 1"->"Contents 1","Tab 2"->"Contents 2","Tab 3"->"Contents 3"}]

Conclusion

It is possible to create (almost) standalone applications with the Wolfram language

It is possible to create pretty applications with the Wolfram language

It is possible to do cool stuff with the Wolfram language

CBM Education Summit
  19-20 November 2015
  The Royal Institution, London (Europe)