On Fri, 24 Jul 2009 15:34:35 -0400 Michael Hughes <mary...@compuserve.com> said:

> Notes on using TextBlock:
> 
> After appending strings to the block,
> 
> evas_textblock_cursor_node_first(Cursor);
> 
> moves the cursor back to the beginning of the text. This is generally 
> equivalent to:
> 
> evas_textblock_cursor_line_set(Cursor,0);
> evas_textblock_cursor_pos_set(Cursor,0);
> 
> Functions such as "pos_set" and "char_first" operate within the current 
> line.  They do not cross line boundaries.  Both lines and character 
> positions are counted from zero.
> 
> If you want to have a visible cursor, the function:
> 
> evas_textblock_cursor_char_geometry_get(Cursor, &PosX, &PosY, &Width 
> &Height);
> 
> gives you the pixel coordinates and size of the character box at the 
> cursor position which can be used to resize and move a graphic image to 
> superimpose it on the character.  These coordinates are referenced to 
> the edge of the textblock object so you may have add margins when you 
> use "evas_object_move()" which is referenced to the canvas. Resizing to 
> "Height" will accommodate different fonts but some proportional 
> characters are very narrow so the width of the graphic cursor image 
> should be set as a proportion of the height rather that using the width 
> value returned by the geometry function.  This function will fail and 
> return -1 if the cursor is positioned at the end of a line or on a blank 
> line.
> 
> It is easy to set up a timer callback function to toggle between 
> "object_show" and "object_hide" to make the cursor blink.  Don't forget 
> that the callback function has to return 1 to make the timer cycle.
> 
> The cursor image must have a transparent background so you have to use a 
> format such as PNG which supports that.  JPEG does not.  I could not 
> find a good cursor image and had to make one up.  I have attached it so 
> maybe it will save someone some time.

or - just put cursor BEHIND he textblock object. it'll be underneath then :)

> Now I have to figure out how to position the text cursor in response to 
> a mouse click. At the moment, the only thing I have come up with is to 
> use the "geometry" functions to scan down for the line and then across 
> for the character.  There must be a better way and if anyone knows one, 
> I would like to hear about it!

look at edje. it has an entry build with textblock. all the things u could
want are there. cursors, selections... the works.

hint: evas_textblock_cursor_char_coord_set() :) (create a cursor, set its
position to the x,y of the mouse click. after hat u can query it for
geometry, position (relative to other cursors) etc. :))

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to