\hypertarget{embryo_run_program_8edc-example}{\section{embryo\+\_\+run\+\_\+program.\+edc}
}
This example shows how to run an edje program from embryo code.


\begin{DoxyCodeInclude}
1 collections \{
2    group \{ name: "main";
3       script \{
4          public toggle;
5       \}
6       parts \{
7          part \{ name: "bg";
8             type: RECT;
9             description \{ state: "default" 0.0;
10                color: 255 255 255 255;
11             \}
12          \}
13          part \{ name: "label";
14             type: TEXT;
15             description \{ state: "default" 0.0;
16                color: 0 0 0 255;
17                text \{
18                   text: "Click me.";
19                   font: "Sans";
20                   size: 12;
21                   align: 0.5 0.8;
22                \}
23             \}
24          \}
25          part \{ name: "rect";
26             type: RECT;
27             description \{ state: "default" 0.0;
28                color: 255 0 0 255;
29                max: 30 30;
30                align: 0.1 0.2;
31             \}
32             description \{ state: "default" 1.0;
33                inherit: "default" 0.0;
34                color: 0 0 255 255;
35                align: 0.9 0.2;
36             \}
37          \}
38       \}
39       programs \{
40          program \{ name: "go\_right";
41             action: STATE\_SET "default" 1.0;
42             transition: SINUSOIDAL 1.0;
43             target: "rect";
44          \}
45          program \{ name: "go\_left";
46             action: STATE\_SET "default" 0.0;
47             transition: SINUSOIDAL 1.0;
48             target: "rect";
49          \}
50          program \{
51             signal: "mouse,down,1";
52             source: "label";
53             script \{
54                if (get\_int(toggle) == 0) \{
55                   run\_program(PROGRAM:"go\_right");
56                   set\_int(toggle, 1);
57                \}
58                else \{
59                   run\_program(PROGRAM:"go\_left");
60                   set\_int(toggle, 0);
61                \}
62             \}
63          \}
64       \}
65    \}
66 \}
\end{DoxyCodeInclude}
 