SWT: Position a dialog based upon the position of the caret in a StyledText control?

In order to get the actual postion, the function toDisplay() should be used. For example.

Up vote 1 down vote favorite 1 share g+ share fb share tw.

I have SWT application that is a set of Groups that contain various controls including a StlyedText widget. They are all laid out using the Form layout. I want to show a dialog directly below the caret inside of the StyledText.

However, I have to position the dialog relative to the parent shell. My first idea is to get the position of the shell plus the position of the StyledText plus the offset of the caret. When I try to get the position of the StyledText, it says 0,0 (I assume because of my layout choice, the Form layout).

I don't see a good way to get the position from the FormData either (it appears to be computed). I am able to get the position of the mouse cursor, but I would like to have it be right under what the user is typing. Anyone have any ideas?

Swt link|improve this question asked Oct 13 '10 at 17:19Nick4481618 100% accept rate.

In order to get the actual postion, the function toDisplay() should be used. For example: Point displayPoint = myText. ToDisplay(sqlText.getLocation()); That gets me to the position of the Text.

I then added the caret position in order to move my dialog window to the line of text that is being written: Point caretLocation = myText.getCaret().getLocation(); Point calcPoint = new Point(displayPoint. X+caretLocation. X, displayPoint.

Y+caretLocation. Y); I then used that location to position my dialog window.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions