Re: [Pharo-users] Spec: Binding widgets how to

2016-01-03 Thread Offray Vladimir Luna Cárdenas

Thanks again Nicolai! I will start from here :-).

Offray

On 03/01/16 18:20, Nicolai Hess wrote:



2016-01-03 23:52 GMT+01:00 Offray Vladimir Luna Cárdenas 
mailto:off...@riseup.net>>:


Hi,

On 03/01/16 08:45, Nicolai Hess wrote:



There is any way to run a minimal GUI with a tree using your
example? I'm still missing a key concept on how to use spec
and binding between widgets.


what is missing ? this is a minimal gui with a tree component.


Ohh, what is missing is not in the example, but in my
understanding on how to use/start it. I would expect for something
like "example openWithSpec" to start deconstructing it, but I'm
still lost about it. I will be working on it today and tomorrow to
see if I can come with better questions.


Ok, for this example you can just start it with:

TreeDemo new openWithSpec

It opens a window with two panes, the upper pane shows a tree with 
some nodes (subclasses of class Morph)
The lower pane shows the text(name) of the selected node. You can 
change and accept (cmd+s) the text in the

lower pane, which will update the name of the tree node.


Cheers,

Offray






Re: [Pharo-users] Spec: Binding widgets how to

2016-01-03 Thread Nicolai Hess
2016-01-03 23:52 GMT+01:00 Offray Vladimir Luna Cárdenas 
:

> Hi,
>
> On 03/01/16 08:45, Nicolai Hess wrote:
>
>
>
>
>>
>> There is any way to run a minimal GUI with a tree using your example? I'm
>> still missing a key concept on how to use spec and binding between widgets.
>>
>
> what is missing ? this is a minimal gui with a tree component.
>
>
>
> Ohh, what is missing is not in the example, but in my understanding on how
> to use/start it. I would expect for something like "example openWithSpec"
> to start deconstructing it, but I'm still lost about it. I will be working
> on it today and tomorrow to see if I can come with better questions.
>

Ok, for this example you can just start it with:

TreeDemo new openWithSpec

It opens a window with two panes, the upper pane shows a tree with some
nodes (subclasses of class Morph)
The lower pane shows the text(name) of the selected node. You can change
and accept (cmd+s) the text in the
lower pane, which will update the name of the tree node.



>
> Cheers,
>
> Offray
>


Re: [Pharo-users] Spec: Binding widgets how to

2016-01-03 Thread Offray Vladimir Luna Cárdenas

Hi,

On 03/01/16 08:45, Nicolai Hess wrote:



There is any way to run a minimal GUI with a tree using your
example? I'm still missing a key concept on how to use spec and
binding between widgets.


what is missing ? this is a minimal gui with a tree component.


Ohh, what is missing is not in the example, but in my understanding on 
how to use/start it. I would expect for something like "example 
openWithSpec" to start deconstructing it, but I'm still lost about it. I 
will be working on it today and tomorrow to see if I can come with 
better questions.


Cheers,

Offray


Re: [Pharo-users] Spec: Binding widgets how to

2016-01-03 Thread Nicolai Hess
2015-12-23 16:50 GMT+01:00 Offray Vladimir Luna Cárdenas 
:

> Thanks Nicolai for your minimalist example. Only until now I have time to
> test it (sorry), but I get some "MessageNotUnderstood:
> SpecTreeNodeModel>>layoutFrame:" when I run this:
>
> =
> | aClass subItems |
> aClass := RTObject.
> subItems := RTObject subclasses.
> "create the node"
> t :=  TreeNodeModel new
> content: aClass name;
> hasChildren: [ aClass subclasses notEmpty ];
> children: [ subItems ifNil:[subItems:=aClass subclasses collect: [
> :s | self buildNodeFor: s ] ]];
> yourself.
> "listen on selection"
> t whenSelectedChanged: [ :bool | bool ifTrue:[self field text: t content]
> ].
> t openWithSpec
> =
>

The children block codee only works as part of the class I defined with the
method buildNodeFor:
( it calls "self buildNodeFor:")





>
> There is any way to run a minimal GUI with a tree using your example? I'm
> still missing a key concept on how to use spec and binding between widgets.
>

what is missing ? this is a minimal gui with a tree component.


>
> Thanks,
>
> Offray
>
>
> On 29/11/15 13:51, Nicolai Hess wrote:
>
>
>
> 2015-11-26 19:36 GMT+01:00 Offray Vladimir Luna Cárdenas <
> off...@riseup.net>:
>
>> Hi,
>>
>> I had tried that before and didn't work. Passing information between
>> widgets and back in this spec interface seems my stop point now... If
>> someone could help me with some kind of minimalist example that uses
>> treeModel, that would be greatly appreciated.
>>
>
> Find attached a minimal example. (I use Morph and its subclasses for
> generating some tree data, these are just names, renaming a node does not
> rename the class :))
>
> You can listen on tree node selection by registering with
> #whenSelectedChanged, on the TreeNode(!)
>
> "create the node"
> t :=  TreeNodeModel new
> content: aClass name;
> hasChildren: [ aClass subclasses notEmpty ];
> children: [ subItems ifNil:[subItems:=aClass subclasses collect: [
> :s | self buildNodeFor: s ] ]];
> yourself.
>
> "listen on selection"
> t whenSelectedChanged: [ :bool | bool ifTrue:[self field text: t content]
> ].
>
> this will change the text field content with the content of the node (the
> default label).
>
> Changing the label node *Morph* on accepting the text field text is
> somehow impossible or difficult.
> I would have expected that Spec would create a MorphicTreeNodeAdapter that
> represents some Morph, for which the adapter would update/change the state,
> if you change
> the TreeNodeModel content.
> Instead, it creates some strange SpecTreeNodeModel. And the only way to
> update the NodeLabel and make this change visible is to
> rebuild the whole tree:
>
> tree roots: tree roots.
>
> Yes, I did not find another way.
>
> Luckily MorphTreeMorph is smart enough to remember the selection and path
> expansion state, so this works quite well.
>
>
>
>>
>> Cheers,
>>
>> Offray
>>
>>
>> On 26/11/15 12:47, webwarrior wrote:
>>
>>> Try #whenHighlightedItemChanged: method.
>>>
>>> I remember that distinction between selection/highlight is not very
>>> clear in
>>> TreeModel.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> 
>>> http://forum.world.st/Spec-Binding-widgets-how-to-tp4863742p4863757.html
>>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>>
>
>


Re: [Pharo-users] Spec: Binding widgets how to

2015-12-23 Thread Offray Vladimir Luna Cárdenas
Thanks Nicolai for your minimalist example. Only until now I have time 
to test it (sorry), but I get some "MessageNotUnderstood: 
SpecTreeNodeModel>>layoutFrame:" when I run this:


=
| aClass subItems |
aClass := RTObject.
subItems := RTObject subclasses.
"create the node"
t :=  TreeNodeModel new
content: aClass name;
hasChildren: [ aClass subclasses notEmpty ];
children: [ subItems ifNil:[subItems:=aClass subclasses 
collect: [ :s | self buildNodeFor: s ] ]];

yourself.
"listen on selection"
t whenSelectedChanged: [ :bool | bool ifTrue:[self field text: t content] ].
t openWithSpec
=

There is any way to run a minimal GUI with a tree using your example? 
I'm still missing a key concept on how to use spec and binding between 
widgets.


Thanks,

Offray

On 29/11/15 13:51, Nicolai Hess wrote:



2015-11-26 19:36 GMT+01:00 Offray Vladimir Luna Cárdenas 
mailto:off...@riseup.net>>:


Hi,

I had tried that before and didn't work. Passing information
between widgets and back in this spec interface seems my stop
point now... If someone could help me with some kind of minimalist
example that uses treeModel, that would be greatly appreciated.


Find attached a minimal example. (I use Morph and its subclasses for 
generating some tree data, these are just names, renaming a node does 
not rename the class :))


You can listen on tree node selection by registering with 
#whenSelectedChanged, on the TreeNode(!)


"create the node"
t :=  TreeNodeModel new
content: aClass name;
hasChildren: [ aClass subclasses notEmpty ];
children: [ subItems ifNil:[subItems:=aClass subclasses 
collect: [ :s | self buildNodeFor: s ] ]];

yourself.

"listen on selection"
t whenSelectedChanged: [ :bool | bool ifTrue:[self field text: t 
content] ].


this will change the text field content with the content of the node 
(the default label).


Changing the label node *Morph* on accepting the text field text is 
somehow impossible or difficult.
I would have expected that Spec would create a MorphicTreeNodeAdapter 
that represents some Morph, for which the adapter would update/change 
the state, if you change

the TreeNodeModel content.
Instead, it creates some strange SpecTreeNodeModel. And the only way 
to update the NodeLabel and make this change visible is to

rebuild the whole tree:

tree roots: tree roots.

Yes, I did not find another way.

Luckily MorphTreeMorph is smart enough to remember the selection and 
path expansion state, so this works quite well.



Cheers,

Offray


On 26/11/15 12:47, webwarrior wrote:

Try #whenHighlightedItemChanged: method.

I remember that distinction between selection/highlight is not
very clear in
TreeModel.



--
View this message in context:
http://forum.world.st/Spec-Binding-widgets-how-to-tp4863742p4863757.html
Sent from the Pharo Smalltalk Users mailing list archive at
Nabble.com.









Re: [Pharo-users] Spec: Binding widgets how to

2015-11-29 Thread Nicolai Hess
2015-11-26 19:36 GMT+01:00 Offray Vladimir Luna Cárdenas 
:

> Hi,
>
> I had tried that before and didn't work. Passing information between
> widgets and back in this spec interface seems my stop point now... If
> someone could help me with some kind of minimalist example that uses
> treeModel, that would be greatly appreciated.
>

Find attached a minimal example. (I use Morph and its subclasses for
generating some tree data, these are just names, renaming a node does not
rename the class :))

You can listen on tree node selection by registering with
#whenSelectedChanged, on the TreeNode(!)

"create the node"
t :=  TreeNodeModel new
content: aClass name;
hasChildren: [ aClass subclasses notEmpty ];
children: [ subItems ifNil:[subItems:=aClass subclasses collect: [
:s | self buildNodeFor: s ] ]];
yourself.

"listen on selection"
t whenSelectedChanged: [ :bool | bool ifTrue:[self field text: t content] ].

this will change the text field content with the content of the node (the
default label).

Changing the label node *Morph* on accepting the text field text is somehow
impossible or difficult.
I would have expected that Spec would create a MorphicTreeNodeAdapter that
represents some Morph, for which the adapter would update/change the state,
if you change
the TreeNodeModel content.
Instead, it creates some strange SpecTreeNodeModel. And the only way to
update the NodeLabel and make this change visible is to
rebuild the whole tree:

tree roots: tree roots.

Yes, I did not find another way.

Luckily MorphTreeMorph is smart enough to remember the selection and path
expansion state, so this works quite well.



>
> Cheers,
>
> Offray
>
>
> On 26/11/15 12:47, webwarrior wrote:
>
>> Try #whenHighlightedItemChanged: method.
>>
>> I remember that distinction between selection/highlight is not very clear
>> in
>> TreeModel.
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Spec-Binding-widgets-how-to-tp4863742p4863757.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
>>
>>
>
>


Tree-TextField-Demo-NicolaiHess.2.mcz
Description: Binary data


Re: [Pharo-users] Spec: Binding widgets how to

2015-11-26 Thread Offray Vladimir Luna Cárdenas

Hi,

I had tried that before and didn't work. Passing information between 
widgets and back in this spec interface seems my stop point now... If 
someone could help me with some kind of minimalist example that uses 
treeModel, that would be greatly appreciated.


Cheers,

Offray

On 26/11/15 12:47, webwarrior wrote:

Try #whenHighlightedItemChanged: method.

I remember that distinction between selection/highlight is not very clear in
TreeModel.



--
View this message in context: 
http://forum.world.st/Spec-Binding-widgets-how-to-tp4863742p4863757.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.







Re: [Pharo-users] Spec: Binding widgets how to

2015-11-26 Thread webwarrior
Try #whenHighlightedItemChanged: method.

I remember that distinction between selection/highlight is not very clear in
TreeModel.



--
View this message in context: 
http://forum.world.st/Spec-Binding-widgets-how-to-tp4863742p4863757.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



[Pharo-users] Spec: Binding widgets how to

2015-11-26 Thread Offray Vladimir Luna Cárdenas

Hi,

I'm starting to migrate my grafoscopio interface from only GT to 
Spec-Glamorous. I have kind of a working layout as you can see:




and now I want to bind the different widgets so when I select a tree 
node I can show/edit its title and contents. I have read the Spec 
documentation on how to do this [1] and the ListSelectionModel code from 
Spec-Examples, but seems I'm missing something.


[1] http://spec.st/docs/interactions/

So, I have a

GrafoscopioGUI>>initializePresenter
tree whenSelectedItemChanged: [ self updateHeader ]

and

GrafoscopioGUI>>updateHeader
"update the displayed text associated to the header"

^ nodeHeader text: tree selectedItem.


but when I move on the tree, nothing happens in the header panel at the 
bottom.


What I'm missing?

Thanks,

Offray