This example shows how to manipulate T\-E\-X\-T and T\-E\-X\-T\-B\-L\-O\-C\-K parts from code.

The very first we are going to do is register a callback to react to changes in the text of our parts\-:  
\begin{DoxyCodeInclude}
   \hyperlink{group__Edje__Part__Text_ga904315af4569b1f3aa75e56dfa59d109}{edje\_object\_text\_change\_cb\_set}(edje\_obj, \_on\_text\_change, NULL);

\end{DoxyCodeInclude}


 
\begin{DoxyCodeInclude}
\_on\_text\_change(\textcolor{keywordtype}{void} *data EINA\_UNUSED, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *part)

\end{DoxyCodeInclude}
 \begin{DoxyNote}{Note}
Since edje\-\_\-obj represent a group we'll be notified whenever any part's text in that group changes.
\end{DoxyNote}
We now set the text for two our two parts\-:  
\begin{DoxyCodeInclude}
   \hyperlink{group__Edje__Part__Text_gad063fc0e1771d774fb6d23f682e68462}{edje\_object\_part\_text\_set}(edje\_obj, \textcolor{stringliteral}{"part\_one"}, \textcolor{stringliteral}{"one"});
   \hyperlink{group__Edje__Part__Text_gad063fc0e1771d774fb6d23f682e68462}{edje\_object\_part\_text\_set}(edje\_obj, \textcolor{stringliteral}{"part\_two"}, \textcolor{stringliteral}{"<b>two"});

\end{DoxyCodeInclude}
 \begin{DoxyNote}{Note}
Since the \char`\"{}part\-\_\-two\char`\"{} part is a T\-E\-X\-T\-B\-L\-O\-C\-K we can use formatting such as $<$b$>$
\end{DoxyNote}
And we now move on to selection issues, first thing we do is make sure the user can select text\-:  
\begin{DoxyCodeInclude}
   \hyperlink{group__Edje__Text__Selection_gaafac342db79c85b50cb063b73ab1bffd}{edje\_object\_part\_text\_select\_allow\_set}(edje\_obj, \textcolor{stringliteral}{"part\_two"}, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});

\end{DoxyCodeInclude}


We then select the entire text, and print the selected text\-:  
\begin{DoxyCodeInclude}
   printf(\textcolor{stringliteral}{"selection: %s\(\backslash\)n"}, \hyperlink{group__Edje__Text__Selection_ga473aaafddaf658634682535f13fad6fe}{edje\_object\_part\_text\_selection\_get}(
      edje\_obj, \textcolor{stringliteral}{"part\_two"}));

\end{DoxyCodeInclude}


We now unselect the entire text(set selection to none), and print the selected text\-:  
\begin{DoxyCodeInclude}
   \hyperlink{group__Edje__Text__Selection_gaa353f2ce979d07f5f37267d59816c07a}{edje\_object\_part\_text\_select\_none}(edje\_obj, \textcolor{stringliteral}{"part\_two"});
   printf(\textcolor{stringliteral}{"selection: %s\(\backslash\)n"}, \hyperlink{group__Edje__Text__Selection_ga473aaafddaf658634682535f13fad6fe}{edje\_object\_part\_text\_selection\_get}(
      edje\_obj, \textcolor{stringliteral}{"part\_two"}));

\end{DoxyCodeInclude}


Our example will look like this\-:

  
\begin{DoxyImage}
\includegraphics{edje-text}
\caption{width=}
\end{DoxyImage}


The full source code follows\-: 
\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#ifdef HAVE\_CONFIG\_H}
\textcolor{preprocessor}{}\textcolor{preprocessor}{# include "config.h"}
\textcolor{preprocessor}{#else}
\textcolor{preprocessor}{}\textcolor{preprocessor}{# define EINA\_UNUSED}
\textcolor{preprocessor}{}\textcolor{preprocessor}{#endif}
\textcolor{preprocessor}{}
\textcolor{preprocessor}{#ifndef PACKAGE\_DATA\_DIR}
\textcolor{preprocessor}{}\textcolor{preprocessor}{#define PACKAGE\_DATA\_DIR "."}
\textcolor{preprocessor}{}\textcolor{preprocessor}{#endif}
\textcolor{preprocessor}{}
\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}>}
\textcolor{preprocessor}{#include <\hyperlink{Edje_8h}{Edje.h}>}

\textcolor{preprocessor}{#define WIDTH  (300)}
\textcolor{preprocessor}{}\textcolor{preprocessor}{#define HEIGHT (300)}
\textcolor{preprocessor}{}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_delete(Ecore\_Evas *ee EINA\_UNUSED)
\{
   \hyperlink{group__Ecore__Main__Loop__Group_ga329898ea4b32333c12c34cfde48326fd}{ecore\_main\_loop\_quit}();
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_text\_change(\textcolor{keywordtype}{void} *data EINA\_UNUSED, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *obj, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *part)
\{
   printf(\textcolor{stringliteral}{"text: %s\(\backslash\)n"}, \hyperlink{group__Edje__Part__Text_gaf8f9ad2ce109f890e5d073bfea9c63d9}{edje\_object\_part\_text\_unescaped\_get}(obj, part));
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc EINA\_UNUSED, \textcolor{keywordtype}{char} *argv[] EINA\_UNUSED)
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *edje\_file = PACKAGE\_DATA\_DIR\textcolor{stringliteral}{"/text.edj"};
   Ecore\_Evas  *ee;
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}        *evas;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *edje\_obj;

   \textcolor{keywordflow}{if} (!\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}())
     \textcolor{keywordflow}{return} EXIT\_FAILURE;

   \textcolor{keywordflow}{if} (!\hyperlink{group__Edje__General__Group_ga1c9c6594f38023c29fbfb2d0c8c675db}{edje\_init}())
     \textcolor{keywordflow}{goto} shutdown\_ecore\_evas;

   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}
\textcolor{comment}{    * engine available */}
   ee = \hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   \textcolor{keywordflow}{if} (!ee) \textcolor{keywordflow}{goto} shutdown\_edje;

   \hyperlink{group__Ecore__Evas__Group_ga3d478e975e2101b9b821ef24baf3dd9e}{ecore\_evas\_callback\_delete\_request\_set}(ee, \_on\_delete);
   \hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}(ee, \textcolor{stringliteral}{"Edje text Example"});

   evas = \hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(ee);

   bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(evas);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}
   \hyperlink{group__Evas__Object__Group__Basic_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(bg, 0, 0); \textcolor{comment}{/* at canvas' origin */}
   \hyperlink{group__Evas__Object__Group__Basic_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);
   \hyperlink{group__Ecore__Evas__Group_gac35627a5c3a766ee42762dbcc9eb733d}{ecore\_evas\_object\_associate}(ee, bg, ECORE\_EVAS\_OBJECT\_ASSOCIATE\_BASE);

   edje\_obj = \hyperlink{group__Edje__Object__Group_ga2fb20b8db9d2c4384cca17e2f7637c40}{edje\_object\_add}(evas);

   \hyperlink{group__Edje__Object__File_gaec1edd24b5bd8e82823759a8dddc1996}{edje\_object\_file\_set}(edje\_obj, edje\_file, \textcolor{stringliteral}{"example\_group"});
   \hyperlink{group__Evas__Object__Group__Basic_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(edje\_obj, 20, 20);
   \hyperlink{group__Evas__Object__Group__Basic_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(edje\_obj, WIDTH - 40, HEIGHT - 40);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(edje\_obj);

   \hyperlink{group__Edje__Part__Text_ga904315af4569b1f3aa75e56dfa59d109}{edje\_object\_text\_change\_cb\_set}(edje\_obj, \_on\_text\_change, NULL);
   \hyperlink{group__Edje__Part__Text_gad063fc0e1771d774fb6d23f682e68462}{edje\_object\_part\_text\_set}(edje\_obj, \textcolor{stringliteral}{"part\_one"}, \textcolor{stringliteral}{"one"});
   \hyperlink{group__Edje__Part__Text_gad063fc0e1771d774fb6d23f682e68462}{edje\_object\_part\_text\_set}(edje\_obj, \textcolor{stringliteral}{"part\_two"}, \textcolor{stringliteral}{"<b>two"});

   \hyperlink{group__Edje__Text__Selection_gaafac342db79c85b50cb063b73ab1bffd}{edje\_object\_part\_text\_select\_allow\_set}(edje\_obj, \textcolor{stringliteral}{"part\_two"}, 
      \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   \hyperlink{group__Edje__Text__Selection_ga512fb3acdebd983589acc57ee2697779}{edje\_object\_part\_text\_select\_all}(edje\_obj, \textcolor{stringliteral}{"part\_two"});
   printf(\textcolor{stringliteral}{"selection: %s\(\backslash\)n"}, \hyperlink{group__Edje__Text__Selection_ga473aaafddaf658634682535f13fad6fe}{edje\_object\_part\_text\_selection\_get}(
      edje\_obj, \textcolor{stringliteral}{"part\_two"}));
   \hyperlink{group__Edje__Text__Selection_gaa353f2ce979d07f5f37267d59816c07a}{edje\_object\_part\_text\_select\_none}(edje\_obj, \textcolor{stringliteral}{"part\_two"});
   printf(\textcolor{stringliteral}{"selection: %s\(\backslash\)n"}, \hyperlink{group__Edje__Text__Selection_ga473aaafddaf658634682535f13fad6fe}{edje\_object\_part\_text\_selection\_get}(
      edje\_obj, \textcolor{stringliteral}{"part\_two"}));

   \hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}(ee);

   \hyperlink{group__Ecore__Main__Loop__Group_ga04daa7648a9d027bed25d27c150fdda7}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}(ee);
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}();

   \textcolor{keywordflow}{return} EXIT\_SUCCESS;

 shutdown\_edje:
   \hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}();
 shutdown\_ecore\_evas:
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();

   \textcolor{keywordflow}{return} EXIT\_FAILURE;
\}
\end{DoxyCodeInclude}


The theme used in this example is\-: 
\begin{DoxyCodeInclude}
collections \{
   group \{
      name: \textcolor{stringliteral}{"sel\_group"};
      parts \{
         part \{
            name: \textcolor{stringliteral}{"rect"};
            type: RECT;
            description \{
               state: \textcolor{stringliteral}{"default"} 0.0;
               color: 0 255 0 255; \textcolor{comment}{/* green */}
               rel1.relative: 0.0 0.0;
               rel2.relative: 1.0 1.0;
            \}
         \}
      \}
   \}
   group \{
      name: \textcolor{stringliteral}{"example\_group"};
      max: 500 500;
      min: 50 50;

      styles \{
         style \{
            name: \textcolor{stringliteral}{"textblock\_style"};
            base: \textcolor{stringliteral}{"font=Sans font\_size=22 color=#600 wrap=word"};
            tag:  \textcolor{stringliteral}{"br"} \textcolor{stringliteral}{"\(\backslash\)n"};
            tag:  \textcolor{stringliteral}{"hilight"} \textcolor{stringliteral}{"+ font\_weight=Bold"};
            tag:  \textcolor{stringliteral}{"b"} \textcolor{stringliteral}{"+ font\_weight=Bold"};
            tag:  \textcolor{stringliteral}{"tab"} \textcolor{stringliteral}{"\(\backslash\)t"};
         \}
      \}
      parts \{
         part \{
            name: \textcolor{stringliteral}{"part\_one"};
            type: TEXT;
            description \{
               min: 50 50;
               state: \textcolor{stringliteral}{"default"} 0.0;
               color: 0 0 255 255; \textcolor{comment}{/* blue */}
               rel1.relative: 0.0 0.0;
               rel2.relative: 1.0 0.5;
               text \{
                  font: \textcolor{stringliteral}{"arial"};
                  size: 22;
                  min: 1 1;
               \}
            \}
         \}
         part \{
            name: \textcolor{stringliteral}{"part\_two"};
            type: TEXTBLOCK;
            select\_mode: EXPLICIT;
            source: \textcolor{stringliteral}{"sel\_group"};
            entry\_mode: PLAIN;
            description \{
               min: 50 50;
               state: \textcolor{stringliteral}{"default"} 0.0;
               rel1.relative: 0.0 0.5;
               rel2.relative: 1.0 1.0;
               text \{
                  style: \textcolor{stringliteral}{"textblock\_style"};
                  min: 1 1;
               \}
            \}
         \}
      \}
   \}
\}
\end{DoxyCodeInclude}


To compile use this command\-: \begin{DoxyVerb}* gcc -o edje-text edje-text.c -DPACKAGE_BIN_DIR=\"/Where/enlightenment/is/installed/bin\" -DPACKAGE_LIB_DIR=\"/Where/enlightenment/is/installed/lib\"
* -DPACKAGE_DATA_DIR=\"/Where/enlightenment/is/installed/share\"
* `pkg-config --cflags --libs evas ecore ecore-evas edje`
*
* edje_cc text.edc
* \end{DoxyVerb}
 