Painful Form errors

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

Painful Form errors

Karl Ramberg
Hi,
While playing around and kicking the tires I came upon this code in class side SimpleHierarchicalListMorph>>notExpandedForm.

If you nil out variable notExpandedForm and run the method you will probably get wrong resulting form eg. the little triangle in SimpleHierarchicalListMorph.
The triangles black outline becomes transparent if screen depth is 32 bit when the form is created.

This is because this method relies on display depth set to 16 bit to give right result :-(
Not very intuitive at all.

Does anybody have suggestions for a fix ?


Best,
Karl


Reply | Threaded
Open this post in threaded view
|

Re: Painful Form errors

marcel.taeumel
Hi Karl,

the semi-colon after "asFormOfDepth: Display depth" is wrong because that call creates a new form. You have to wrap it into parentheses and then call "replace.." on the result. :-)

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: Painful Form errors

Karl Ramberg
Thanks, that works.
We can just call:
expandedForm replaceColor: Color white withColor: Color transparent

The method Form>>replaceColor: oldColor withColor: newColor does change the form in place so there is no need to re-assign to the variable. 
I'm a little confused to why this did not work before.

Best,
Karl

On Thu, Feb 18, 2016 at 4:18 PM, marcel.taeumel <[hidden email]> wrote:
Hi Karl,

the semi-colon after "asFormOfDepth: Display depth" is wrong because that
call creates a new form. You have to wrap it into parentheses and then call
"replace.." on the result. :-)

Best,
Marcel



--
View this message in context: http://forum.world.st/Painful-Form-errors-tp4878535p4878550.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: Painful Form errors

Karl Ramberg
Duh, ignore last mail...
I understand now :-)



Best,
Karl

On Thu, Feb 18, 2016 at 5:24 PM, karl ramberg <[hidden email]> wrote:
Thanks, that works.
We can just call:
expandedForm replaceColor: Color white withColor: Color transparent

The method Form>>replaceColor: oldColor withColor: newColor does change the form in place so there is no need to re-assign to the variable. 
I'm a little confused to why this did not work before.

Best,
Karl

On Thu, Feb 18, 2016 at 4:18 PM, marcel.taeumel <[hidden email]> wrote:
Hi Karl,

the semi-colon after "asFormOfDepth: Display depth" is wrong because that
call creates a new form. You have to wrap it into parentheses and then call
"replace.." on the result. :-)

Best,
Marcel



--
View this message in context: http://forum.world.st/Painful-Form-errors-tp4878535p4878550.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.





Reply | Threaded
Open this post in threaded view
|

Re: Painful Form errors

Karl Ramberg
Anyway, this fix gained a little speed up for larger lists, since the cached form always was wrong before, and was recreated for each instance :-)





Best,
Karl

On Thu, Feb 18, 2016 at 5:32 PM, karl ramberg <[hidden email]> wrote:
Duh, ignore last mail...
I understand now :-)



Best,
Karl

On Thu, Feb 18, 2016 at 5:24 PM, karl ramberg <[hidden email]> wrote:
Thanks, that works.
We can just call:
expandedForm replaceColor: Color white withColor: Color transparent

The method Form>>replaceColor: oldColor withColor: newColor does change the form in place so there is no need to re-assign to the variable. 
I'm a little confused to why this did not work before.

Best,
Karl

On Thu, Feb 18, 2016 at 4:18 PM, marcel.taeumel <[hidden email]> wrote:
Hi Karl,

the semi-colon after "asFormOfDepth: Display depth" is wrong because that
call creates a new form. You have to wrap it into parentheses and then call
"replace.." on the result. :-)

Best,
Marcel



--
View this message in context: http://forum.world.st/Painful-Form-errors-tp4878535p4878550.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.