separate native window of same Pharo image

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

separate native window of same Pharo image

Peter Uhnák
Hi,

did anyone play around with launching a separate native window for Pharo?

E.g. I have normal window in which Pharo is, and then I open a separate native window that shows just e.g. Transcript.

I know that there are some projects like OSWindow-SDL and OSWindows-UI (using WinAPI), but both of them are aimed at opening windows with non-pharo content, which is not what I want.

Any pointers?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: separate native window of same Pharo image

alvaro piorno
Hi,
I played a bit with that. I did something like this:

window := OSWindow createWithAttributes: (OSWindowAttributes new resizable: false; yourself).
window title: title.

And then:

surface := AthensCairoSDLSurface fromSDLSurface: self window handle handle getWindowSurface


Then you can render everything in the surface from Pharo.

Is this what you want?.




2018-07-19 8:31 GMT-03:00 Peter Uhnák <[hidden email]>:
Hi,

did anyone play around with launching a separate native window for Pharo?

E.g. I have normal window in which Pharo is, and then I open a separate native window that shows just e.g. Transcript.

I know that there are some projects like OSWindow-SDL and OSWindows-UI (using WinAPI), but both of them are aimed at opening windows with non-pharo content, which is not what I want.

Any pointers?

Thanks,
Peter

kmo
Reply | Threaded
Open this post in threaded view
|

Re: separate native window of same Pharo image

kmo
In reply to this post by Peter Uhnák
it is perfectly possible with OS-Window to create a morphic world and create
your own morphic content for it, then display it in a completely different
operating system window.

This is how I created a simple application which displays geometric "roses"
in a separate window to the pharo window.

First create your morph. In my case RosesMorph. This can be a compound morph
with as many sub-morphs as you like. In this way you can build a complete
application interface.

Now create a sub class of OSWindowWorldMorph like this:

OSWindowWorldMorph subclass: #RosesWorldMorph
        instanceVariableNames: ''
        classVariableNames: ''
        package: 'KMP-Roses

Add the following methods to your OSWindowWorldMorph subclass using this
code as a model:

RosesWorldMorph>>osWindowCloseButtonPressed
        self delete

RosesWorldMorph>>initialize
        | rosesMorph rosesFrame |
        super initialize.
        self layoutPolicy: ProportionalLayout new.
        self extent: 600 @ 600.
        self osWindow title: 'Roses'.
        rosesMorph := RosesMorph new.
        rosesMorph
                color:
                        (Color
                                r: 0.13
                                g: 0.13
                                b: 0.13
                                alpha: 1.0).
        rosesFrame := LayoutFrame
                fractions: (0 @ 0 corner: 1 @ 1)
                offsets: (0 @ 0 corner: 0 @ 0).
        self addMorph: rosesMorph fullFrame: rosesFrame.
        rosesMorph sticky: true
 
As you can see once you have an OSWindowWorldMorph you can add whatever
morphs you like to it.

Now you can launch your RosesWorld app in a separate window like this:

RosesWorldMorph new open.

Hope this helps


 



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

kmo
Reply | Threaded
Open this post in threaded view
|

Re: separate native window of same Pharo image

kmo
Here's a screenshot of two roses windows being run from a pharo image in
another window <http://forum.world.st/file/t368903/roses.png>



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: separate native window of same Pharo image

Peter Uhnák
Thank you both, this is exactly what I was looking for!

But I ran into an issue (maybe this is Windows (10) specific):

once I open the window, the original Pharo window is no longer responsive. It is not frozen, I can see a cursor blinking in the playground, but clicking anywhere or pressing any key doesn't do anything.
This behavior persists even after I close the new window.
Only when I press ctrl (without anything else) the content of the playground gets executed again, but that's it.

I will try tomorrow on a different machine.

Peter

On Thu, Jul 19, 2018 at 6:22 PM, kmo <[hidden email]> wrote:
Here's a screenshot of two roses windows being run from a pharo image in
another window <http://forum.world.st/file/t368903/roses.png>

kmo
Reply | Threaded
Open this post in threaded view
|

Re: separate native window of same Pharo image

kmo
I believe this is a known Windows issue. I have certainly seen it on my
Windows machine at work. Doesn't happen on Linux.

 



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: separate native window of same Pharo image

Peter Uhnák
>  I believe this is a known Windows issue.

Well this is more of a show-stopper than just an issue.

Is the project maintained? Is Windows support something that is planned?

Thanks,
Peter

On Thu, Jul 19, 2018 at 7:35 PM kmo <[hidden email]> wrote:
I believe this is a known Windows issue. I have certainly seen it on my
Windows machine at work. Doesn't happen on Linux.





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

kmo
Reply | Threaded
Open this post in threaded view
|

Re: separate native window of same Pharo image

kmo
Who knows whether OSWindow is maintained? Who knows if anybody cares that it
doesn't work on Windows?

OSWindow is like lots of things that suddenly appear in the Pharo standard
image. There's no documentation. There's no plan. That's the Pharo way. Give
it a year or two and it will be superseded by another framework doing the
same thing which will also have no documentation, killer bugs, and no plan.



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html