Pharo desktop UI

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

Pharo desktop UI

vikenti
Hello, i'm newbie in Pharo, converted from Visual Works which is quite different from Pharo Smalltalk.
I started to port my application (i've been working on for about three years) from VW (because of new personal user licensing limitations of Visual Works), but i have to solve some problems and need your advice.

These ase some of the most important problems:
1.  I need to rewrite the whole GUI from scratch. What UI framework to choose and where to get documentation? Please, don't send me to research code examples instead of docs - i do this during whole last week. The example should be complete and simple: one task - one example, all examples i've seen are either not applicable to real life or too complicated to understand.
 - I need simple window with menu (how to attach menu items to menu handlers???? - no answer in examples)
 - Toolbar with icons (how????????)
 - components (as i understand - Morphic subclasses, it is the simplest part)
 - when window opens i need handler to do some setup actions. Handler should fire after UI is built and my app's window is opened (how?????)
 - i need another handler, which fires when you try to close Pharo or application's window. Handler must check whether to close window or not and do allow or not to close my application.
 - how to programmatically close window??????

2. The next task is to do some work on image load (i mean pharo image). I need some handler which fires immediately after image is loaded. How to include my handler in this chain???? My app saves data into the image so i need to manage this and auto-load _my_ application after startup.

3. How to drag-n-drop from the host operation system into pharo application and vice versa? I need to drag-n-drop a list of files from\to file browser.

4. Application deployment. How to strip the unnecessary code from the image? I've heard there is "small image" to add all-i-need-to-run. Where i can download it and how to use it????  




 
Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

jfabry
Hello Vikenti,

for writing UIs in Pharo the UI builder you should use is Spec. We have documentation online in the form of a book (which is a work in progress).I think it will answer many of your UI questions, have a look at http://files.pharo.org/books/spec-tutorial/ 

HTH,

--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org .

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

> On 02 Nov 2016, at 18:43, vikenti <[hidden email]> wrote:
>
> Hello, i'm newbie in Pharo, converted from Visual Works which is quite
> different from Pharo Smalltalk.
> I started to port my application (i've been working on for about three
> years) from VW (because of new personal user licensing limitations of Visual
> Works), but i have to solve some problems and need your advice.
>
> These ase some of the most important problems:
> 1.  I need to rewrite the whole GUI from scratch. What UI framework to
> choose and where to get documentation? Please, don't send me to research
> code examples instead of docs - i do this during whole last week. The
> example should be complete and simple: one task - one example, all examples
> i've seen are either not applicable to real life or too complicated to
> understand.
> - I need simple window with menu (how to attach menu items to menu
> handlers???? - no answer in examples)
> - Toolbar with icons (how????????)
> - components (as i understand - Morphic subclasses, it is the simplest
> part)
> - when window opens i need handler to do some setup actions. Handler should
> fire after UI is built and my app's window is opened (how?????)
> - i need another handler, which fires when you try to close Pharo or
> application's window. Handler must check whether to close window or not and
> do allow or not to close my application.
> - how to programmatically close window??????
>
> 2. The next task is to do some work on image load (i mean pharo image). I
> need some handler which fires immediately after image is loaded. How to
> include my handler in this chain???? My app saves data into the image so i
> need to manage this and auto-load _my_ application after startup.
>
> 3. How to drag-n-drop from the host operation system into pharo application
> and vice versa? I need to drag-n-drop a list of files from\to file browser.
>
> 4. Application deployment. How to strip the unnecessary code from the image?
> I've heard there is "small image" to add all-i-need-to-run. Where i can
> download it and how to use it????  
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/Pharo-desktop-UI-tp4921212.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

vikenti

Thanks!
After looking through this manual i successfully created simple window with cascaded menu which.
I will deeply research this book.

One more question: how to add separator to the menu group?
either MenuGroupModel nor MenuItemModel has special selector but autocompletion shows me "addSeparator", if i use it  - i get an error.

On Wed, 2 Nov 2016 14:53:56 -0700 (PDT)
"jfabry [via Smalltalk]" <[hidden email]> wrote:

>
>
> Hello Vikenti,
>
> for writing UIs in Pharo the UI builder you should use is Spec. We have documentation online in the form of a book (which is a work in progress).I think it will answer many of your UI questions, have a look at http://files.pharo.org/books/spec-tutorial/ 
>
> HTH,
>
> --
> Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org .
>
> Johan Fabry   -   http://pleiad.cl/~jfabry
> PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile
>
> > On 02 Nov 2016, at 18:43, vikenti <[hidden email]> wrote:
> >
> > Hello, i'm newbie in Pharo, converted from Visual Works which is quite
> > different from Pharo Smalltalk.
> > I started to port my application (i've been working on for about three
> > years) from VW (because of new personal user licensing limitations of Visual
> > Works), but i have to solve some problems and need your advice.
> >
> > These ase some of the most important problems:
> > 1.  I need to rewrite the whole GUI from scratch. What UI framework to
> > choose and where to get documentation? Please, don't send me to research
> > code examples instead of docs - i do this during whole last week. The
> > example should be complete and simple: one task - one example, all examples
> > i've seen are either not applicable to real life or too complicated to
> > understand.
> > - I need simple window with menu (how to attach menu items to menu
> > handlers???? - no answer in examples)
> > - Toolbar with icons (how????????)
> > - components (as i understand - Morphic subclasses, it is the simplest
> > part)
> > - when window opens i need handler to do some setup actions. Handler should
> > fire after UI is built and my app's window is opened (how?????)
> > - i need another handler, which fires when you try to close Pharo or
> > application's window. Handler must check whether to close window or not and
> > do allow or not to close my application.
> > - how to programmatically close window??????
> >
> > 2. The next task is to do some work on image load (i mean pharo image). I
> > need some handler which fires immediately after image is loaded. How to
> > include my handler in this chain???? My app saves data into the image so i
> > need to manage this and auto-load _my_ application after startup.
> >
> > 3. How to drag-n-drop from the host operation system into pharo application
> > and vice versa? I need to drag-n-drop a list of files from\to file browser.
> >
> > 4. Application deployment. How to strip the unnecessary code from the image?
> > I've heard there is "small image" to add all-i-need-to-run. Where i can
> > download it and how to use it????  
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://forum.world.st/Pharo-desktop-UI-tp4921212.html
> > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >
> >
>
>
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.world.st/Pharo-desktop-UI-tp4921212p4921213.html
>
> To unsubscribe from Pharo desktop UI, visit
С уважением,
Викентий Потапов

http://vikenti.ru
тел.: +7 (917) 880 25 07 (г. Казань)
Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

jfabry

I’m happy that the documentation is of help to you!

Sorry but I don’t have an answer to your question at hand right now. Have a look at all the users of MenuModel and friends to see where they are used in the image, you should be able to get the examples you need.

HTH,

--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org .

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

On 02 Nov 2016, at 21:09, vikenti <[hidden email]> wrote:

One more question: how to add separator to the menu group? 
either MenuGroupModel nor MenuItemModel has special selector but autocompletion shows me "addSeparator", if i use it  - i get an error. 

Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

stepharo
In reply to this post by jfabry
http://books.pharo.org

and you can contribute if when reading you think something is missing.

and you can also contribute by improving Spec.

Stef


Le 2/11/16 à 23:01, Johan Fabry a écrit :

> Hello Vikenti,
>
> for writing UIs in Pharo the UI builder you should use is Spec. We have documentation online in the form of a book (which is a work in progress).I think it will answer many of your UI questions, have a look at http://files.pharo.org/books/spec-tutorial/
>
> HTH,
>
> --
> Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org .
>
> Johan Fabry   -   http://pleiad.cl/~jfabry
> PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile
>
>> On 02 Nov 2016, at 18:43, vikenti <[hidden email]> wrote:
>>
>> Hello, i'm newbie in Pharo, converted from Visual Works which is quite
>> different from Pharo Smalltalk.
>> I started to port my application (i've been working on for about three
>> years) from VW (because of new personal user licensing limitations of Visual
>> Works), but i have to solve some problems and need your advice.
>>
>> These ase some of the most important problems:
>> 1.  I need to rewrite the whole GUI from scratch. What UI framework to
>> choose and where to get documentation? Please, don't send me to research
>> code examples instead of docs - i do this during whole last week. The
>> example should be complete and simple: one task - one example, all examples
>> i've seen are either not applicable to real life or too complicated to
>> understand.
>> - I need simple window with menu (how to attach menu items to menu
>> handlers???? - no answer in examples)
>> - Toolbar with icons (how????????)
>> - components (as i understand - Morphic subclasses, it is the simplest
>> part)
>> - when window opens i need handler to do some setup actions. Handler should
>> fire after UI is built and my app's window is opened (how?????)
>> - i need another handler, which fires when you try to close Pharo or
>> application's window. Handler must check whether to close window or not and
>> do allow or not to close my application.
>> - how to programmatically close window??????
>>
>> 2. The next task is to do some work on image load (i mean pharo image). I
>> need some handler which fires immediately after image is loaded. How to
>> include my handler in this chain???? My app saves data into the image so i
>> need to manage this and auto-load _my_ application after startup.
>>
>> 3. How to drag-n-drop from the host operation system into pharo application
>> and vice versa? I need to drag-n-drop a list of files from\to file browser.
>>
>> 4. Application deployment. How to strip the unnecessary code from the image?
>> I've heard there is "small image" to add all-i-need-to-run. Where i can
>> download it and how to use it????
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://forum.world.st/Pharo-desktop-UI-tp4921212.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

stepharo
In reply to this post by vikenti


Le 2/11/16 à 22:43, vikenti a écrit :

> Hello, i'm newbie in Pharo, converted from Visual Works which is quite
> different from Pharo Smalltalk.
> I started to port my application (i've been working on for about three
> years) from VW (because of new personal user licensing limitations of Visual
> Works), but i have to solve some problems and need your advice.
>
> These ase some of the most important problems:
> 1.  I need to rewrite the whole GUI from scratch. What UI framework to
> choose and where to get documentation? Please, don't send me to research
> code examples instead of docs - i do this during whole last week. The
> example should be complete and simple: one task - one example, all examples
> i've seen are either not applicable to real life or too complicated to
> understand.
>   - I need simple window with menu (how to attach menu items to menu
> handlers???? - no answer in examples)
>   - Toolbar with icons (how????????)
>   - components (as i understand - Morphic subclasses, it is the simplest
> part)
>   - when window opens i need handler to do some setup actions. Handler should
> fire after UI is built and my app's window is opened (how?????)
>   - i need another handler, which fires when you try to close Pharo or
> application's window. Handler must check whether to close window or not and
> do allow or not to close my application.
>   - how to programmatically close window??????
>
> 2. The next task is to do some work on image load (i mean pharo image). I
> need some handler which fires immediately after image is loaded. How to
> include my handler in this chain???? My app saves data into the image so i
> need to manage this and auto-load _my_ application after startup.
look for startup or startUp or startUpList

> 3. How to drag-n-drop from the host operation system into pharo application
> and vice versa? I need to drag-n-drop a list of files from\to file browser.
I do not remember but there is a way to do that.
For example when you drop a .cs file it gets loaded.
> 4. Application deployment. How to strip the unnecessary code from the image?
> I've heard there is "small image" to add all-i-need-to-run. Where i can
> download it and how to use it????

- Do you need to strip your image?
- for the small image we are producing one but I'm not sure that you
want to lose your time with it right now.

Stef

>
>
>
>
>  
>
>
>
>
> --
> View this message in context: http://forum.world.st/Pharo-desktop-UI-tp4921212.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

Pavel Krivanek-3
In reply to this post by vikenti
For older Pharo versions there exists framework for native UI named Phobos that uses XULRunner to display user interface.


-- Pavel

2016-11-02 22:43 GMT+01:00 vikenti <[hidden email]>:
Hello, i'm newbie in Pharo, converted from Visual Works which is quite
different from Pharo Smalltalk.
I started to port my application (i've been working on for about three
years) from VW (because of new personal user licensing limitations of Visual
Works), but i have to solve some problems and need your advice.

These ase some of the most important problems:
1.  I need to rewrite the whole GUI from scratch. What UI framework to
choose and where to get documentation? Please, don't send me to research
code examples instead of docs - i do this during whole last week. The
example should be complete and simple: one task - one example, all examples
i've seen are either not applicable to real life or too complicated to
understand.
 - I need simple window with menu (how to attach menu items to menu
handlers???? - no answer in examples)
 - Toolbar with icons (how????????)
 - components (as i understand - Morphic subclasses, it is the simplest
part)
 - when window opens i need handler to do some setup actions. Handler should
fire after UI is built and my app's window is opened (how?????)
 - i need another handler, which fires when you try to close Pharo or
application's window. Handler must check whether to close window or not and
do allow or not to close my application.
 - how to programmatically close window??????

2. The next task is to do some work on image load (i mean pharo image). I
need some handler which fires immediately after image is loaded. How to
include my handler in this chain???? My app saves data into the image so i
need to manage this and auto-load _my_ application after startup.

3. How to drag-n-drop from the host operation system into pharo application
and vice versa? I need to drag-n-drop a list of files from\to file browser.

4. Application deployment. How to strip the unnecessary code from the image?
I've heard there is "small image" to add all-i-need-to-run. Where i can
download it and how to use it????









--
View this message in context: http://forum.world.st/Pharo-desktop-UI-tp4921212.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

kilon.alios
Hello mr newbie, welcome to our island :)

"1.  I need to rewrite the whole GUI from scratch. What UI framework to
choose and where to get documentation?"

Johan already recommended Spec , I think its the best fit for you. If you want more customisation you can always use Morphic together with Spec.

"2. The next task is to do some work on image load (i mean pharo image). I
need some handler which fires immediately after image is loaded. How to
include my handler in this chain???? My app saves data into the image so i
need to manage this and auto-load _my_ application after startup."

This can happen in two way, the image provide a method called starUp for when the image starts and shutDown when the image closes. Any object can have these methods and Pharo will always make sure to execute them.

Startup scripts are also an alternative , they are capable of firing only the first time you open the image or every time. I will be making a tutorial shortly for them but you can find an example in the mean time in my repo here

https://github.com/kilon/makePharo/blob/master/startupPharo.st

The nice thing about startup scripts is that they can be per image but also globally for all your images

"
3. How to drag-n-drop from the host operation system into pharo application
and vice versa? I need to drag-n-drop a list of files from\to file browser."

Drag and Drop can be a tricky one because its a Morphic and will require some experience with Morphic. Morph  which is basically the base class of all  gui element 3 relevant methods.

a) dropFiles:
b) handleDropFiles:
c) wantsDropFiles:

PasteUpMorph dropFiles: is the the method that handles dropped files on the background of the Pharo window. Of course PasteUpMorph inherits from Morph .

I cannot give you any more info because I never tried to use it.

"4. Application deployment. How to strip the unnecessary code from the image?
I've heard there is "small image" to add all-i-need-to-run. Where i can
download it and how to use it????"

There will not be a tool that will do this for you automagically. There is project to bootstrap Pharo.

It also depends why you want to get rid of those unecessary packages, if you wanna do it to decrease Pharo size on your disk then unfortunately you wont achieve much because Cuis for example that has 13 times less classes than pharo is only 50% smaller and thats the image alone, obviously VM is same size.

If you are worried about quick updates and you dont want your user to redownload pharo , there is a way to update your code via git and github wihout your user having to install git or be github member. You could even auto update in the background.

The only Smalltalk that I am aware of that can go bellow 10mbs , which is what is I would call "small" , is spoon that can get even tiny, down to just 1 kb without the vm.


Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

Ben Coman
In reply to this post by vikenti
On Thu, Nov 3, 2016 at 5:43 AM, vikenti <[hidden email]> wrote:
> 2. The next task is to do some work on image load (i mean pharo image). I
> need some handler which fires immediately after image is loaded. How to
> include my handler in this chain???? My app saves data into the image so i
> need to manage this and auto-load _my_ application after startup.

Take a look at the two class methods #startUp: and #initialize
at [1] under "Inter-session persistency" ...

[1] http://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-2-simple-callout-string-return/

cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

Ben Coman
In reply to this post by kilon.alios
On Thu, Nov 3, 2016 at 10:05 PM, Dimitris Chloupis
<[hidden email]> wrote:
> "
> 3. How to drag-n-drop from the host operation system into pharo application
> and vice versa? I need to drag-n-drop a list of files from\to file browser."

I don't know the answer to what you ask, but the experiment code I
attached to [1] may also be of interest.
Its a couple of years old but I don't think much has changed in that
area for a while.
If you drop the attachment into your Monticello package-cache you can
load it from there.

[1] http://forum.world.st/example-custom-mouse-events-td4773821.html

cheers -ben

> Drag and Drop can be a tricky one because its a Morphic and will require
> some experience with Morphic. Morph  which is basically the base class of
> all  gui element 3 relevant methods.
>
> a) dropFiles:
> b) handleDropFiles:
> c) wantsDropFiles:

Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

vikenti

Thanks for advices, i added them to my work notes.

Working with Spec i found another problem:
I create a window with simple layout: menu + custom morph. I want my morph to do some interactive work for me - it must display data and handle mouse down\move\wheel.

The problem is: when i start the morph alone - it works. When i start my custom morph inside the spec layout, it doesn't handle mouse events or sometimes handles them randomly.

custom morph is a subclass of Morph, initialize widgets and defaultSpec are very simple:

initializeWidgets
        menu := self instantiate: MenuModel.
        self setupMenu.  <- I added menu items here.
        menu applyTo: self.
        locationField := LocationFieldMorph new asSpecAdapter.

defaultSpec
        <spec: #default>
        ^ SpecLayout composed
                newColumn:
                        [ :col |
                        col
                                newRow: [ :row | row add: #menu ] height: 32;
                                newRow: [ :row | row add: #locationField ] ]
                        yourself

all stuff in LocationFieldMorph (my custom morph) is done as described in "Pharo By Example" and works fine when not arranged in Spec layout. What is wrong?

Few other questions:
- how to switch focus between controls in Spec layout programmatically? (for example, i need one of the controls to become in focus)
- how to determine whether a control is in focus or not? (i want to know if my custom morph widget is in focus and draw a sign to show that fact to user)



On Thu, 3 Nov 2016 08:46:29 -0700 (PDT)
"Ben Coman [via Smalltalk]" <[hidden email]> wrote:

>
>
> On Thu, Nov 3, 2016 at 10:05 PM, Dimitris Chloupis
> <[hidden email]> wrote:
> > "
> > 3. How to drag-n-drop from the host operation system into pharo application
> > and vice versa? I need to drag-n-drop a list of files from\to file browser."
>
> I don't know the answer to what you ask, but the experiment code I
> attached to [1] may also be of interest.
> Its a couple of years old but I don't think much has changed in that
> area for a while.
> If you drop the attachment into your Monticello package-cache you can
> load it from there.
>
> [1] http://forum.world.st/example-custom-mouse-events-td4773821.html
>
> cheers -ben
>
> > Drag and Drop can be a tricky one because its a Morphic and will require
> > some experience with Morphic. Morph  which is basically the base class of
> > all  gui element 3 relevant methods.
> >
> > a) dropFiles:
> > b) handleDropFiles:
> > c) wantsDropFiles:
>
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.world.st/Pharo-desktop-UI-tp4921212p4921354.html
>
> To unsubscribe from Pharo desktop UI, visit
С уважением,
Викентий Потапов

http://vikenti.ru
тел.: +7 (917) 880 25 07 (г. Казань)
Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

vikenti
In reply to this post by Ben Coman

Last time i wrote about problem with catching mouse events in custom morph embedded in Spec layout.
The reason was very simple: my custom widget didn't resized automatically so events were handled properly only in the small area - the area of base class morph size.

On Thu, 3 Nov 2016 08:46:29 -0700 (PDT)
"Ben Coman [via Smalltalk]" <[hidden email]> wrote:

>
>
> On Thu, Nov 3, 2016 at 10:05 PM, Dimitris Chloupis
> <[hidden email]> wrote:
> > "
> > 3. How to drag-n-drop from the host operation system into pharo application
> > and vice versa? I need to drag-n-drop a list of files from\to file browser."
>
> I don't know the answer to what you ask, but the experiment code I
> attached to [1] may also be of interest.
> Its a couple of years old but I don't think much has changed in that
> area for a while.
> If you drop the attachment into your Monticello package-cache you can
> load it from there.
>
> [1] http://forum.world.st/example-custom-mouse-events-td4773821.html
>
> cheers -ben
>
> > Drag and Drop can be a tricky one because its a Morphic and will require
> > some experience with Morphic. Morph  which is basically the base class of
> > all  gui element 3 relevant methods.
> >
> > a) dropFiles:
> > b) handleDropFiles:
> > c) wantsDropFiles:
>
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.world.st/Pharo-desktop-UI-tp4921212p4921354.html
>
> To unsubscribe from Pharo desktop UI, visit
С уважением,
Викентий Потапов

http://vikenti.ru
тел.: +7 (917) 880 25 07 (г. Казань)
Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

vikenti
In reply to this post by stepharo

New problem with Spec.

Layout consists of menu and custom control (subclass of Morph created by asSpecAdapter):
initializeWidgets
        menu := self instantiate: MenuModel.
        self setupMenu.
        menu applyTo: self.
        locationField := LocationFieldMorph new asSpecAdapter.

defaultSpec
        <spec: #default>
        ^ SpecLayout composed
                newColumn:
                        [ :col |
                        col
                                add: #menu height: self toolbarHeight;
                                add: #locationField
                        ] yourself

My custom control doesn't automatically resize to fill the area reserved to it by layout spec.
I've tried different existed controls instead of mine but didn't find any solution. Some controls resized (TextModal) some didn't (Morph, BorderedMorph, EllipseMorph).

I did a dirty hack: in onDraw: of my custom control i set bounds: to aCanvas clipRect and it works fine.

drawOn: aCanvas
        self bounds: aCanvas clipRect .
        .... other code ....

But i think it is a wrong solution and there is somewhere a simple property to setup ( or something like it ).

Any ideas?


On Thu, 3 Nov 2016 05:28:25 -0700 (PDT)
"stepharo [via Smalltalk]" <[hidden email]> wrote:

>
>
>
>
> Le 2/11/16 à 22:43, vikenti a écrit :
> > Hello, i'm newbie in Pharo, converted from Visual Works which is quite
> > different from Pharo Smalltalk.
> > I started to port my application (i've been working on for about three
> > years) from VW (because of new personal user licensing limitations of Visual
> > Works), but i have to solve some problems and need your advice.
> >
> > These ase some of the most important problems:
> > 1.  I need to rewrite the whole GUI from scratch. What UI framework to
> > choose and where to get documentation? Please, don't send me to research
> > code examples instead of docs - i do this during whole last week. The
> > example should be complete and simple: one task - one example, all examples
> > i've seen are either not applicable to real life or too complicated to
> > understand.
> >   - I need simple window with menu (how to attach menu items to menu
> > handlers???? - no answer in examples)
> >   - Toolbar with icons (how????????)
> >   - components (as i understand - Morphic subclasses, it is the simplest
> > part)
> >   - when window opens i need handler to do some setup actions. Handler should
> > fire after UI is built and my app's window is opened (how?????)
> >   - i need another handler, which fires when you try to close Pharo or
> > application's window. Handler must check whether to close window or not and
> > do allow or not to close my application.
> >   - how to programmatically close window??????
> >
> > 2. The next task is to do some work on image load (i mean pharo image). I
> > need some handler which fires immediately after image is loaded. How to
> > include my handler in this chain???? My app saves data into the image so i
> > need to manage this and auto-load _my_ application after startup.
> look for startup or startUp or startUpList
>
> > 3. How to drag-n-drop from the host operation system into pharo application
> > and vice versa? I need to drag-n-drop a list of files from\to file browser.
> I do not remember but there is a way to do that.
> For example when you drop a .cs file it gets loaded.
> > 4. Application deployment. How to strip the unnecessary code from the image?
> > I've heard there is "small image" to add all-i-need-to-run. Where i can
> > download it and how to use it????
>
> - Do you need to strip your image?
> - for the small image we are producing one but I'm not sure that you
> want to lose your time with it right now.
>
> Stef
>
> >
> >
> >
> >
> >  
> >
> >
> >
> >
> > --
> > View this message in context: http://forum.world.st/Pharo-desktop-UI-tp4921212.html
> > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >
> >
>
>
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.world.st/Pharo-desktop-UI-tp4921212p4921278.html
>
> To unsubscribe from Pharo desktop UI, visit
С уважением,
Викентий Потапов

http://vikenti.ru
тел.: +7 (917) 880 25 07 (г. Казань)
Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

jfabry
Hello Vikenti,

I think that you are using the SpecAdapter for morphs in ways it has never been tried or used. So the problems you are having reveal bugs in the SpecAdapter. Please file a bug report, and feel free to contribute a fix as well of course ;-) (more about bugreports here: http://pharo.org/contribute )

--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org .

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

On 05 Nov 2016, at 21:37, vikenti <[hidden email]> wrote:


New problem with Spec. 

Layout consists of menu and custom control (subclass of Morph created by asSpecAdapter): 
initializeWidgets 
        menu := self instantiate: MenuModel.
        self setupMenu. 
        menu applyTo: self. 
        locationField := LocationFieldMorph new asSpecAdapter. 

defaultSpec 
        <spec: #default> 
        ^ SpecLayout composed 
                newColumn: 
                        [ :col | 
                        col 
                                add: #menu height: self toolbarHeight;
                                add: #locationField 
                        ] yourself 

My custom control doesn't automatically resize to fill the area reserved to it by layout spec. 
I've tried different existed controls instead of mine but didn't find any solution. Some controls resized (TextModal) some didn't (Morph, BorderedMorph, EllipseMorph). 

I did a dirty hack: in onDraw: of my custom control i set bounds: to aCanvas clipRect and it works fine. 

drawOn: aCanvas 
        self bounds: aCanvas clipRect . 
        .... other code .... 

But i think it is a wrong solution and there is somewhere a simple property to setup ( or something like it ). 

Any ideas? 

Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

vikenti

Maybe you can give some brief explanaition how to create Spec-compatible custom UI control? (Like TextModel or ButtonModel, etc.) How to create model class, corresponding adapter and how to process common and custom UI events (mouse\keyboard\focus ordering\changing).
I think such guide should also be included in Spec booklet.

On Sun, 6 Nov 2016 10:01:39 -0800 (PST)
"jfabry [via Smalltalk]" <[hidden email]> wrote:

>
>
> Hello Vikenti,
>
> I think that you are using the SpecAdapter for morphs in ways it has never been tried or used. So the problems you are having reveal bugs in the SpecAdapter. Please file a bug report, and feel free to contribute a fix as well of course ;-) (more about bugreports here: http://pharo.org/contribute )
>
> --
> Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org <http://emailcharter.org/> .
>
> Johan Fabry   -   http://pleiad.cl/~jfabry
> PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile
>
> > On 05 Nov 2016, at 21:37, vikenti <[hidden email]> wrote:
> >
> >
> > New problem with Spec.
> >
> > Layout consists of menu and custom control (subclass of Morph created by asSpecAdapter):
> > initializeWidgets
> >         menu := self instantiate: MenuModel.
> >         self setupMenu.
> >         menu applyTo: self.
> >         locationField := LocationFieldMorph new asSpecAdapter.
> >
> > defaultSpec
> >         <spec: #default>
> >         ^ SpecLayout composed
> >                 newColumn:
> >                         [ :col |
> >                         col
> >                                 add: #menu height: self toolbarHeight;
> >                                 add: #locationField
> >                         ] yourself
> >
> > My custom control doesn't automatically resize to fill the area reserved to it by layout spec.
> > I've tried different existed controls instead of mine but didn't find any solution. Some controls resized (TextModal) some didn't (Morph, BorderedMorph, EllipseMorph).
> >
> > I did a dirty hack: in onDraw: of my custom control i set bounds: to aCanvas clipRect and it works fine.
> >
> > drawOn: aCanvas
> >         self bounds: aCanvas clipRect .
> >         .... other code ....
> >
> > But i think it is a wrong solution and there is somewhere a simple property to setup ( or something like it ).
> >
> > Any ideas?
>
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.world.st/Pharo-desktop-UI-tp4921212p4921932.html
>
> To unsubscribe from Pharo desktop UI, visit
С уважением,
Викентий Потапов

http://vikenti.ru
тел.: +7 (917) 880 25 07 (г. Казань)
Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

jfabry
I understand what you are asking, in previous versions of the documentation we had something like this. However this turned out to be a bad idea since this is too closely linked to the actual implementation. Making internal changes to the Spec interpreter means that this documentation also needs to be updated. We don’t have the resources for that, sadly this documentation became out of date and simply wrong so we had to remove it.

So for what you are asking the code is the only reference, sorry. 

--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org .

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

On 06 Nov 2016, at 18:23, vikenti <[hidden email]> wrote:

Maybe you can give some brief explanaition how to create Spec-compatible custom UI control? (Like TextModel or ButtonModel, etc.) How to create model class, corresponding adapter and how to process common and custom UI events (mouse\keyboard\focus ordering\changing). 
I think such guide should also be included in Spec booklet. 

Reply | Threaded
Open this post in threaded view
|

Re: Pharo desktop UI

vikenti

Ok, i understand. The Spec famework is under development so it changes frequently.

Regarding my problem - thanks to Denis Kudriashov - the solution is simple:

initializeWidgets
        ...
        locationField := LocationFieldMorph new asSpecAdapter.
        "adding these two lines below forces morph to occupy all layout cell"
        locationField morph vResizing: #spaceFill.
        locationField morph hResizing: #spaceFill.
        ...


On Mon, 7 Nov 2016 06:26:41 -0800 (PST)
"jfabry [via Smalltalk]" <[hidden email]> wrote:

>
>
> I understand what you are asking, in previous versions of the documentation we had something like this. However this turned out to be a bad idea since this is too closely linked to the actual implementation. Making internal changes to the Spec interpreter means that this documentation also needs to be updated. We don’t have the resources for that, sadly this documentation became out of date and simply wrong so we had to remove it.
>
> So for what you are asking the code is the only reference, sorry.
>
> --
> Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org <http://emailcharter.org/> .
>
> Johan Fabry   -   http://pleiad.cl/~jfabry
> PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile
>
> > On 06 Nov 2016, at 18:23, vikenti <[hidden email]> wrote:
> >
> > Maybe you can give some brief explanaition how to create Spec-compatible custom UI control? (Like TextModel or ButtonModel, etc.) How to create model class, corresponding adapter and how to process common and custom UI events (mouse\keyboard\focus ordering\changing).
> > I think such guide should also be included in Spec booklet.
>
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.world.st/Pharo-desktop-UI-tp4921212p4922070.html
>
> To unsubscribe from Pharo desktop UI, visit
С уважением,
Викентий Потапов

http://vikenti.ru
тел.: +7 (917) 880 25 07 (г. Казань)