[Pharo-project] completion appears in the wrong place
Hi, I would like to get my model for a PluggableTextMorph work with ECompletion/OCompletion. To this end, I basically looked around for examples, and found OBTextPanel and its subclasses. So, I basically copied the following methods in my model (GLMSmalltalkCodeModel in the Glamour repo) and things seemed work fine: completionController | controller | controller := self triggerEvent: #getCompletionController. controller ifNil: [controller := self initializeCompletionController]. ^controller initializeCompletionController | controller | controller := self createCompletionController. self when: #getCompletionController evaluate: (MessageSend receiver: controller selector: #yourself). ^ controller createCompletionController ^(ECPreferences useECompletionInsteadOfOCompletion ifFalse: [ OController ] ifTrue: [ ECController ]) model: self Now, the problem is that when the textmorph in which I am rendering this is in a GLMFinder using an implementation similar to the one of OB, and somehow the completion looks to be rendered in absolute coordinates, rather than relative to the window (see the attached screenshots). Any hints regarding what goes wrong? Cheers, Doru -- www.tudorgirba.com "Speaking louder won't make the point worthier."
Any ideas? :) Doru Begin forwarded message:
From: Tudor Girba <tudor@tudorgirba.com> Subject: completion appears in the wrong place Date: 2 October 2011 18:16:41 CEST To: Pharo Development <pharo-project@lists.gforge.inria.fr>
Hi,
I would like to get my model for a PluggableTextMorph work with ECompletion/OCompletion.
To this end, I basically looked around for examples, and found OBTextPanel and its subclasses. So, I basically copied the following methods in my model (GLMSmalltalkCodeModel in the Glamour repo) and things seemed work fine:
completionController | controller | controller := self triggerEvent: #getCompletionController. controller ifNil: [controller := self initializeCompletionController]. ^controller
initializeCompletionController | controller | controller := self createCompletionController. self when: #getCompletionController evaluate: (MessageSend receiver: controller selector: #yourself). ^ controller
createCompletionController ^(ECPreferences useECompletionInsteadOfOCompletion ifFalse: [ OController ] ifTrue: [ ECController ]) model: self
Now, the problem is that when the textmorph in which I am rendering this is in a GLMFinder using an implementation similar to the one of OB, and somehow the completion looks to be rendered in absolute coordinates, rather than relative to the window (see the attached screenshots).
Any hints regarding what goes wrong?
Cheers, Doru
-- www.tudorgirba.com
"Speaking louder won't make the point worthier."
-- www.tudorgirba.com "What is more important: To be happy, or to make happy?"
On 10 October 2011 09:54, Tudor Girba <tudor@tudorgirba.com> wrote:
Any ideas? :)
Doru
Have one. A PluggableTextMorph (and text morphs in general) using 0-based coordinates in their bounds. But they are usually wrapped by scroll pane / transform morph which doing local/global coordinate transformation for submorphs, therefore a submorphs positions could be in non-global coordinate system. -- Best regards, Igor Stasenko.
On 10 October 2011 14:25, Igor Stasenko <siguctua@gmail.com> wrote:
On 10 October 2011 09:54, Tudor Girba <tudor@tudorgirba.com> wrote:
Any ideas? :) Doru
Have one. A PluggableTextMorph (and text morphs in general) using 0-based coordinates in their bounds. But they are usually wrapped by scroll pane / transform morph which doing local/global coordinate transformation for submorphs, therefore a submorphs positions could be in non-global coordinate system.
You can see #boundInWorld implementation and follow it, to see how to obtain global coordinates from local ones.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
participants (2)
-
Igor Stasenko -
Tudor Girba