[Gtk-sharp-list] Text input in drawing area

Andy Selvig ajselvig at gmail.com
Mon Jan 11 17:14:41 EST 2010


I did a small app a while ago using Gtk# and Mono that had the functionality
you're looking for (I think, I can't see your mockup behind the proxy at
work). Basically, I had everything in an EventBox* as the high level
"Canvas". Then I add a Fixed layout to the EventBox and an Entry to that. So
now there's an Entry that I can move to anywhere inside the EventBox using
Fixed.Move() and show and hide at will. There's a link to the file in
question below.

This solution seemed to work well. I basically made a method on my Canvas
that told it to show or hide the line entry at a certain position. So any
object in the scene can decide to get text from the user when they want to
(as long as there's only one object doing it at a time). I suppose you could
create an Entry for each object in your scene that needs to be able to get
text from the user, but that seems unnecessary.

Does this make sense?

http://code.google.com/p/lodas/
http://code.google.com/p/lodas/source/browse/trunk/lodas/Lodas/Gui/Canvas.cs

* From what I can tell, this can be used interchangeably with DrawingArea,
except EventBox gives all the UI support out of the box. With DrawingArea,
you have to add the event masks and create new handlers for the interaction
events. EventBox lets you create a Cairo context on the Expose event just
like DrawingArea, so I'm not entirely sure why the latter even exists.


On Mon, Jan 11, 2010 at 4:01 PM, Piotr Zurek <p.zurek at gmail.com> wrote:

> Oops... [1] is of course http://www.psycho-project.ORG
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100111/bae93a70/attachment-0001.html 


More information about the Gtk-sharp-list mailing list