Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:create_listener [2015/01/27 15:10]
yarpheuil
tutorial:create_listener [2015/10/05 17:52] (current)
Line 1: Line 1:
 **Listener** is a way to add code to generated UI classes by specifying it in the xml File. **Listener** is a way to add code to generated UI classes by specifying it in the xml File.
-For example, open file <wrap adicode>​$projectDirectory/​resources/​xml/​include/​detail/​FilmDIGENERATED.xml with XML editor.</​wrap>​+For example, open file <wrap adicode>​$projectDirectory/​resources/​xml/​include/​detail/​FilmDI.xml</​wrap> ​with XML editor.\\
 Change element: Change element:
    
-<code xml> +<sxh xml; title: excerpt from '​FilmDI.axml'​ file.
-<text textLimit="​255"​ mandatory="​true"​ property="​title"​ id="​title"/>​ + <text textLimit="​255"​ mandatory="​true"​ property="​title"​ id="​title"/>​ 
-</code>+</sxh>
 by by
-<code xml> +<sxh xml; highlight: [2,​3,​4,​5,​6,​7,​8,​9,​10,​11];​ title: excerpt from '​FilmDI.axml'​ file.
-<text textLimit="​255"​ mandatory="​true"​ property="​title"​ id="​title">​ + <text textLimit="​255"​ mandatory="​true"​ property="​title"​ id="​title">​ 
-    <​listeners>​ +     <​listeners>​ 
-        <​listener listenerTypes="​MODIFY_TEXT">​ +         <​listener listenerTypes="​MODIFY_TEXT">​ 
-             ​<​code>//​Use red if title length &​gt;​=40,​ otherwise use blue color +              <​code>//​Use red if title length &​gt;​=40,​ otherwise use blue color 
-import org.eclipse.swt.SWT+import org.eclipse.swt.SWT;
 if (40 &lt; #​CONTROL(title).getText().length()) if (40 &lt; #​CONTROL(title).getText().length())
     #​CONTROL(title).setForeground(#​COLOR(SWT.COLOR_RED));​     #​CONTROL(title).setForeground(#​COLOR(SWT.COLOR_RED));​
 else else
-    #​CONTROL(title).setForeground(#​COLOR(SWT.COLOR_BLUE));</​code > +    #​CONTROL(title).setForeground(#​COLOR(SWT.COLOR_BLUE));</​code>​ 
-         ​</​listener> ​      +          </​listener>​      ​ 
-     ​</​listeners> ​      +      </​listeners>​      ​ 
-</​text>​ + </​text>​ 
-</code>+</sxh>
    
    
 Open a new editor for the detail of a film, if the description field is longer than 40 letters, then the foreground color pass to Red otherwise the foreground color is Blue. Open a new editor for the detail of a film, if the description field is longer than 40 letters, then the foreground color pass to Red otherwise the foreground color is Blue.
 Be sure that the editor was not already open for the Film, otherwise the editor use the old version without the listener. Be sure that the editor was not already open for the Film, otherwise the editor use the old version without the listener.
tutorial/create_listener.1422367842.txt.gz · Last modified: 2015/09/30 16:46 (external edit)