The TEXTLINE object

This object is used for text editing in one line. You are able to set this object for writing or only for reading. This object is declared in the file dialogs.h. TEXTLINE support DRUG&DROP. When text is selected you will copy only selected text, otherwise you will copy all text.


textline_init ()
     Description:
       Creates a new textline object.

     Syntax:
       p_textline  textline_init ( p_textline o, t_rect r, l_int limit,
                                   l_int flags );

     Parameters:
       o           Allocated memory to store the object in.
       r           Rectangle defining the bounds of the textline.
       limit       The maximum number of characters.
       flags       Option flags. May be the following:

                      TF_REWRITEUNABLE  - Sets textline to read-only.

     Returns:
       The new textline object.




worktextline_init ()
     Description:
       Creates a new textline object that doesn't have the "3D"
       sunken look. Only has a black rectangle as a border.

     Syntax:
       p_textline  worktextline_init( p_textline o, t_rect r, 
                                      l_int limit );

     Parameters:
       o           Allocated memory to store the object in.
       r           Rectangle defining the bounds of the textline.
       limit       The maximum number of characters.

     Returns:
       The new textline object.




Getting or setting the text


     If you want to set the text in the textline you can use either:

        l_bool textline::set_text ( p_textline o, l_text text );

     or the "set_data()" function.


     To get the text you use the "get_data()" function or the
     "textline::text" variable.




Example:


     t_rect r = rect_assign(100, 100, 300, 120);

     p_textline o = textline_init ( malloc(sizeof(t_textline)), 
                                    r, 
                                    100,     /* Limit of textlength. */
                                    0);      /* Set to rewriteable.  */

     OBJECT(desktop)->insert(OBJECT(desktop), OBJECT(o));


     o->set_text("Hello world");             /* Set text to "Hello world". */

     if ( !strcmp(o->text, "Hello world") )  /* Is the text "Hello world"? */

         o->set_text("Hello Mr. Michal Stencl");