custom halos

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

custom halos

Aidan Gauland
Hello,

  I've created a Morph (an indirect subclass of Morph) and I want it to have
an extra halo for bringing up a special menu (or dialog, or etc.).  How can I
do this?

Thanks,
Aidan

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: custom halos

K. K. Subramaniam
On Thursday 02 Oct 2008 6:44:58 am Aidan Gauland wrote:
> Hello,
>
>   I've created a Morph (an indirect subclass of Morph) and I want it to
> have an extra halo for bringing up a special menu (or dialog, or etc.).
> How can I do this?
For adding a new button called BBB, you need to
  1. add a halospec for addBBBHandle to Preferences class (see senders of
addScriptorHandle: for the list)
  2. add wantsBBBHaloHandle to Morph (returning false)
  3. add method addBBBHandle to HaloMorph (see addScriptorHandle: for an
example).
  4. Add wantsBBBHaloHandle method (returning true) and a event handler to
your Morph

See senders and implementors of addScriptorHandle: for an example.

HTH .. Subbu
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: custom halos

Aidan Gauland
K. K. Subramaniam wrote:
> For adding a new button called BBB, you need to
>   1. add a halospec for addBBBHandle to Preferences class (see senders of
> addScriptorHandle: for the list)
How can I do (and undo) this programmatically?

>   2. add wantsBBBHaloHandle to Morph (returning false)
>   3. add method addBBBHandle to HaloMorph (see addScriptorHandle: for an
> example).
>   4. Add wantsBBBHaloHandle method (returning true) and a event handler to
> your Morph
What do you mean by "event handler", and how do I create one for this?

>
> See senders and implementors of addScriptorHandle: for an example.
There does not seem to be any such method.  Did you mean addScriptHandle:?

Thanks,
Aidan

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: custom halos

K. K. Subramaniam
On Saturday 04 Oct 2008 10:55:28 am Aidan Gauland wrote:
> K. K. Subramaniam wrote:
> > For adding a new button called BBB, you need to
> >   1. add a halospec for addBBBHandle to Preferences class (see senders of
> > addScriptorHandle: for the list)
>
> How can I do (and undo) this programmatically?
I don't know of any simple way to do this. The specs are in a method, not in a
global variable. So you will have to recompile the method to add new specs.

> >   2. add wantsBBBHaloHandle to Morph (returning false)
> >   3. add method addBBBHandle to HaloMorph (see addScriptorHandle: for an
> > example).
> >   4. Add wantsBBBHaloHandle method (returning true) and a event handler
> > to your Morph
>
> What do you mean by "event handler", and how do I create one for this?
The part in addScriptHandle:
    .... on: #mouseUp send: #editButtonsScript to: innerTarget

#mouseUp is an event and editButtonsScript is a event handler. innerTarget is
the morph around which the halo appears. It should have a editButtonsScript
method to handle the event.

> > See senders and implementors of addScriptorHandle: for an example.
>
> There does not seem to be any such method.  Did you mean addScriptHandle:?
Yes. Sorry about the typo. I hope it didn't misdirect you for too long.

Subbu
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: custom halos

Aidan Gauland
K. K. Subramaniam wrote:
> On Saturday 04 Oct 2008 10:55:28 am Aidan Gauland wrote:
>> K. K. Subramaniam wrote:
>>> For adding a new button called BBB, you need to
>>>   1. add a halospec for addBBBHandle to Preferences class (see senders of
>>> addScriptorHandle: for the list)
>> How can I do (and undo) this programmatically?
> I don't know of any simple way to do this. The specs are in a method, not in a
> global variable. So you will have to recompile the method to add new specs.

I think I might have found out how: run
PreferencesClass>>installHaloSpecsFromArray: passing it an array in the same
format as the one that Preferences class>>customHaloSpecs or
PreferencesClass>>classicHaloSpecs retruns.

This way, you can include halos in a package.  (I think, I don't know about
removing them later.)

Thanks for the pointers (or references, in Smalltalk).
  -Aidan

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: custom halos

stephane ducasse
You are facing the nonOOP aspect of certain ugly parts of queak.
The fact that halosmorph cannot be defined per class is striking. Nice  
to have a kind of global var, this is were squeak lost OOP.
Once someone fixed that but it was never integrated (probably in 3.7  
or 3.8 days).
For my book I wanted special halos and I had to hack the global  
system. :(
Terribly sad.

Stef


On Oct 6, 2008, at 12:24 AM, Aidan Gauland wrote:

> K. K. Subramaniam wrote:
>> On Saturday 04 Oct 2008 10:55:28 am Aidan Gauland wrote:
>>> K. K. Subramaniam wrote:
>>>> For adding a new button called BBB, you need to
>>>>  1. add a halospec for addBBBHandle to Preferences class (see  
>>>> senders of
>>>> addScriptorHandle: for the list)
>>> How can I do (and undo) this programmatically?
>> I don't know of any simple way to do this. The specs are in a  
>> method, not in a global variable. So you will have to recompile the  
>> method to add new specs.
>
> I think I might have found out how: run  
> PreferencesClass>>installHaloSpecsFromArray: passing it an array in  
> the same format as the one that Preferences class>>customHaloSpecs  
> or PreferencesClass>>classicHaloSpecs retruns.
>
> This way, you can include halos in a package.  (I think, I don't  
> know about removing them later.)
>
> Thanks for the pointers (or references, in Smalltalk).
> -Aidan
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners