Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » paintFigure and Display question
paintFigure and Display question [message #140377] Mon, 28 June 2004 10:30
steven melzer is currently offline steven melzerFriend
Messages: 38
Registered: July 2009
Member
i would like to use a TextLayout in place of the TextFlow/FlowPage. My
reason is to support multiple fonts. so i wrote a TextFigure with the
following paintFigure method:

protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
GC gc = new GC(Display.getCurrent());

Rectangle spAbs = this.getClientArea().getCopy();
Point p1 = control.toDisplay(spAbs.x, spAbs.y);
textLayout.draw(gc, p1.x, p1.y);
}

what happens is when you add text from the TextCellEditor, nothing is
displayed on the figure. but if you grab the figure's handle and start
moving it around, the text is displayed where it should appear when i am
dragging the figure around. so, i assume the "figure" is overlaying on
top of the text.

what exactly is overlaying my text? and is there a better approach to
doing this?

also, i do not believe scrolling will work with my current approach, but
passing in the Viewport, calling getViewLocation, and translating the
point should fix that i think. thoughts?

if this whole approach is wrong, i can always subclass the TextFlow and
use the TextStyles and positions from the TextLayout class to add multiple
font support to the TextFlow, but i believe this will make the whole text
wrapping logic go crazy.

thanks,
steve
Previous Topic:org.eclipse.swt.widgets.Text equivalent in draw2d
Next Topic:GEF + UML2
Goto Forum:
  


Current Time: Thu Sep 19 01:52:43 GMT 2024

Powered by FUDForum. Page generated in 0.04337 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top