views:

167

answers:

1

I'm trying to vertical center a multiline textbox within a RectangleFigure in GEF. It needs to be ajusted on resize.

This would be best done with a layout, but I can't figure out how that works.

I'm adding a BorderMargin to the parent FlowPage and changing the margin when the RectangleFigure gets resized. Unfortunately, at that particular point, the TextFlow hasn't been layouted and it often no longer has the correct number of lines.

Given that all I need is the number of lines, how can I calculate that.

Alternatively, what does an "auto-centering" layout look like?

A: 

I'm not seeing an answer (yet) but I do have some questions:

  • Can you post an example of your code so far?
  • Messing with the parent BorderMargin to center is probably the wrong way to go. What happens if you don't do that?
  • Are you doing invalidateTree() to force recomputation / layout?
  • When you say "all you need is the number of lines," which object are you referring to and what are you intending to do with the answer?
MarkusQ