Glamour Fast List selection bug or incorrect usage?

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

Glamour Fast List selection bug or incorrect usage?

Juraj Kubelka
Hi!

If you create the following Glamour browser:

```
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite fastList display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite fastList display: [ :x | Array with: 2 * x ] ].

tabulator transmit from: #one; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].
tabulator transmit from: #two; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
```

You will get the following browser: 


if you then select 4, the third list appears. If you then select 8, the value is changed:


But since then, the third list does not change. It stays with 8 value forever. 

Do I miss something? Should I define it differently? 
Or if it is a bug: Can you give me insights how to fix it?

Tested in the latest Pharo 6.

Thanks!
Juraj

Reply | Threaded
Open this post in threaded view
|

Re: Glamour Fast List selection bug or incorrect usage?

Andrei Chis
Hi,

That's actually the default behavior, but I see there is also a bug.
Normally if you want to allow deselection in a presentation you should use allowDeselection. Just I see there is a bug in the fast table renderer because if I add #allowDeselection to the first presentation when clicking again on the selected element the selection port is not cleared. If you use #list instead of #fastList it works.

I think you can get the desired behaviur using this code:

-----------------------------------------------------------------
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite list 
allowDeselection;
display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite list
allowDeselection;
display: [ :x | Array with: 2 * x ] ].

tabulator transmit 
from: #one; to: #three;
from: #two; to: #three;
transformed: [ :x :y | y ifNil: [ x ] ifNotNil: [ y ] ];
andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
-----------------------------------------------------------------


Cheers,
Andrei

On Mon, Apr 3, 2017 at 9:35 PM, Juraj Kubelka <[hidden email]> wrote:
Hi!

If you create the following Glamour browser:

```
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite fastList display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite fastList display: [ :x | Array with: 2 * x ] ].

tabulator transmit from: #one; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].
tabulator transmit from: #two; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
```

You will get the following browser: 


if you then select 4, the third list appears. If you then select 8, the value is changed:


But since then, the third list does not change. It stays with 8 value forever. 

Do I miss something? Should I define it differently? 
Or if it is a bug: Can you give me insights how to fix it?

Tested in the latest Pharo 6.

Thanks!
Juraj


Reply | Threaded
Open this post in threaded view
|

Re: Glamour Fast List selection bug or incorrect usage?

Juraj Kubelka
Hi,

yes, it is better, but it does not work intuitively. Try the following: 

1. execute your script,
2. click on 4 (selection), 
3. click on 8 (selection),
4. click on 4 (deselection),
5. click on 4 (selection)

You can see that the third list still keeps the number 8. It is necessary to deselect 8 in order to see 4. 

This part explains to me how the transmit works:

```
tabulator transmit 
from: #one; to: #three;
from: #two; to: #three;
transformed: [ :x :y | y ifNil: [ x ] ifNotNil: [ y ] ];
andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].
```

By using #transformed: I can decide what to use (#one or #two). It is nice feature!

I think what I need is having to possibility to change the third list also according to what list is active (#one or #two). 
In the first screenshot, the first list is active (blue border). In the second screenshot, the second list is active. 
So I would like to update the third list according to the active one. 
Is it possible?


Thanks!
Juraj

On Apr 3, 2017, at 18:53, Andrei Chis <[hidden email]> wrote:

Hi,

That's actually the default behavior, but I see there is also a bug.
Normally if you want to allow deselection in a presentation you should use allowDeselection. Just I see there is a bug in the fast table renderer because if I add #allowDeselection to the first presentation when clicking again on the selected element the selection port is not cleared. If you use #list instead of #fastList it works.

I think you can get the desired behaviur using this code:

-----------------------------------------------------------------
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite list 
allowDeselection;
display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite list
allowDeselection;
display: [ :x | Array with: 2 * x ] ].

tabulator transmit 
from: #one; to: #three;
from: #two; to: #three;
transformed: [ :x :y | y ifNil: [ x ] ifNotNil: [ y ] ];
andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
-----------------------------------------------------------------


Cheers,
Andrei

On Mon, Apr 3, 2017 at 9:35 PM, Juraj Kubelka <[hidden email]> wrote:
Hi!

If you create the following Glamour browser:

```
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite fastList display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite fastList display: [ :x | Array with: 2 * x ] ].

tabulator transmit from: #one; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].
tabulator transmit from: #two; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
```

You will get the following browser: 

<Screen Shot 2017-04-03 at 16.30.28.png>

if you then select 4, the third list appears. If you then select 8, the value is changed:

<Screen Shot 2017-04-03 at 16.29.38.png>

But since then, the third list does not change. It stays with 8 value forever. 

Do I miss something? Should I define it differently? 
Or if it is a bug: Can you give me insights how to fix it?

Tested in the latest Pharo 6.

Thanks!
Juraj



Reply | Threaded
Open this post in threaded view
|

Re: Glamour Fast List selection bug or incorrect usage?

Andrei Chis
Hi,

On Tue, Apr 4, 2017 at 5:01 PM, Juraj Kubelka <[hidden email]> wrote:
Hi,

yes, it is better, but it does not work intuitively. Try the following: 

1. execute your script,
2. click on 4 (selection), 
3. click on 8 (selection),
4. click on 4 (deselection),
5. click on 4 (selection)

You can see that the third list still keeps the number 8. It is necessary to deselect 8 in order to see 4. 

Indeed, this is not what you'd expect.
 

This part explains to me how the transmit works:

```
tabulator transmit 
from: #one; to: #three;
from: #two; to: #three;
transformed: [ :x :y | y ifNil: [ x ] ifNotNil: [ y ] ];
andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].
```

By using #transformed: I can decide what to use (#one or #two). It is nice feature!

I think what I need is having to possibility to change the third list also according to what list is active (#one or #two). 
In the first screenshot, the first list is active (blue border). In the second screenshot, the second list is active. 
So I would like to update the third list according to the active one. 
Is it possible?

Unfortunately this doesn't work out of the box.
We'll need to implement something that can generate evens/populates a port when a presentation gets the focus.

Cheers,
Andrei
 


Thanks!
Juraj

On Apr 3, 2017, at 18:53, Andrei Chis <[hidden email]> wrote:

Hi,

That's actually the default behavior, but I see there is also a bug.
Normally if you want to allow deselection in a presentation you should use allowDeselection. Just I see there is a bug in the fast table renderer because if I add #allowDeselection to the first presentation when clicking again on the selected element the selection port is not cleared. If you use #list instead of #fastList it works.

I think you can get the desired behaviur using this code:

-----------------------------------------------------------------
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite list 
allowDeselection;
display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite list
allowDeselection;
display: [ :x | Array with: 2 * x ] ].

tabulator transmit 
from: #one; to: #three;
from: #two; to: #three;
transformed: [ :x :y | y ifNil: [ x ] ifNotNil: [ y ] ];
andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
-----------------------------------------------------------------


Cheers,
Andrei

On Mon, Apr 3, 2017 at 9:35 PM, Juraj Kubelka <[hidden email]> wrote:
Hi!

If you create the following Glamour browser:

```
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite fastList display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite fastList display: [ :x | Array with: 2 * x ] ].

tabulator transmit from: #one; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].
tabulator transmit from: #two; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
```

You will get the following browser: 

<Screen Shot 2017-04-03 at 16.30.28.png>

if you then select 4, the third list appears. If you then select 8, the value is changed:

<Screen Shot 2017-04-03 at 16.29.38.png>

But since then, the third list does not change. It stays with 8 value forever. 

Do I miss something? Should I define it differently? 
Or if it is a bug: Can you give me insights how to fix it?

Tested in the latest Pharo 6.

Thanks!
Juraj




Reply | Threaded
Open this post in threaded view
|

Re: Glamour Fast List selection bug or incorrect usage?

Juraj Kubelka
Hi Andrei!

On Apr 6, 2017, at 07:05, Andrei Chis <[hidden email]> wrote:

Hi,

On Tue, Apr 4, 2017 at 5:01 PM, Juraj Kubelka <[hidden email]> wrote:
Hi,

yes, it is better, but it does not work intuitively. Try the following: 

1. execute your script,
2. click on 4 (selection), 
3. click on 8 (selection),
4. click on 4 (deselection),
5. click on 4 (selection)

You can see that the third list still keeps the number 8. It is necessary to deselect 8 in order to see 4. 

Indeed, this is not what you'd expect.
 

This part explains to me how the transmit works:

```
tabulator transmit 
from: #one; to: #three;
from: #two; to: #three;
transformed: [ :x :y | y ifNil: [ x ] ifNotNil: [ y ] ];
andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].
```

By using #transformed: I can decide what to use (#one or #two). It is nice feature!

I think what I need is having to possibility to change the third list also according to what list is active (#one or #two). 
In the first screenshot, the first list is active (blue border). In the second screenshot, the second list is active. 
So I would like to update the third list according to the active one. 
Is it possible?

Unfortunately this doesn't work out of the box.
We'll need to implement something that can generate evens/populates a port when a presentation gets the focus.

Does it make sense such feature? 
I am willing to do it. Can you give me some starting points? My knowledge about Glamour design is a bit weak. 

I suppose that it is necessary to subscribe for MorphGotFocus and MorphLostFocus in each renderer and do some actions accordingly, right? 
What are the actions? 

Thanks!
Juraj


Cheers,
Andrei
 

<Screen Shot 2017-04-04 at 11.52.42.png><Screen Shot 2017-04-04 at 11.52.53.png>

Thanks!
Juraj

On Apr 3, 2017, at 18:53, Andrei Chis <[hidden email]> wrote:

Hi,

That's actually the default behavior, but I see there is also a bug.
Normally if you want to allow deselection in a presentation you should use allowDeselection. Just I see there is a bug in the fast table renderer because if I add #allowDeselection to the first presentation when clicking again on the selected element the selection port is not cleared. If you use #list instead of #fastList it works.

I think you can get the desired behaviur using this code:

-----------------------------------------------------------------
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite list 
allowDeselection;
display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite list
allowDeselection;
display: [ :x | Array with: 2 * x ] ].

tabulator transmit 
from: #one; to: #three;
from: #two; to: #three;
transformed: [ :x :y | y ifNil: [ x ] ifNotNil: [ y ] ];
andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
-----------------------------------------------------------------


Cheers,
Andrei

On Mon, Apr 3, 2017 at 9:35 PM, Juraj Kubelka <[hidden email]> wrote:
Hi!

If you create the following Glamour browser:

```
tabulator := GLMTabulator new.

tabulator column: #one; column: #two; column: #three.

tabulator transmit to: #one; andShow: [ :composite |
composite fastList display: [ :x | Array with: x ] ].
tabulator transmit to: #two; andShow: [ :composite |
composite fastList display: [ :x | Array with: 2 * x ] ].

tabulator transmit from: #one; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].
tabulator transmit from: #two; to: #three; andShow: [ :a | 
a fastList display: [ :x | Array with: x ] ].

tabulator openOn: 4.
```

You will get the following browser: 

<Screen Shot 2017-04-03 at 16.30.28.png>

if you then select 4, the third list appears. If you then select 8, the value is changed:

<Screen Shot 2017-04-03 at 16.29.38.png>

But since then, the third list does not change. It stays with 8 value forever. 

Do I miss something? Should I define it differently? 
Or if it is a bug: Can you give me insights how to fix it?

Tested in the latest Pharo 6.

Thanks!
Juraj