completion appears in the wrong place

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

completion appears in the wrong place

Tudor Girba-2
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."


Reply | Threaded
Open this post in threaded view
|

Fwd: completion appears in the wrong place

Tudor Girba-2
Any ideas? :)

Doru


Begin forwarded message:

From: Tudor Girba <[hidden email]>
Subject: completion appears in the wrong place
Date: 2 October 2011 18:16:41 CEST
To: Pharo Development <[hidden email]>

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."




"What is more important: To be happy, or to make happy?"

Reply | Threaded
Open this post in threaded view
|

Re: Fwd: completion appears in the wrong place

Igor Stasenko


On 10 October 2011 09:54, Tudor Girba <[hidden email]> 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.
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: completion appears in the wrong place

Igor Stasenko
On 10 October 2011 14:25, Igor Stasenko <[hidden email]> wrote:

>
>
> On 10 October 2011 09:54, Tudor Girba <[hidden email]> 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.