[squeak-dev] Browser Menus

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

[squeak-dev] Browser Menus

David Zmick
Where can I edit the menu that opens in the default squeak-dev image browser?  I want to add an button to it, but I don't know where to do that.

also, I am very new to morphic, so I might be having a hard time because I am not familiar with the common structure of things.

--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com
htttp://l337.bible.googlepages.com


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Browser Menus

Randal L. Schwartz
>>>>> "David" == David Zmick <[hidden email]> writes:

David> Where can I edit the menu that opens in the default squeak-dev image
David> browser?  I want to add an button to it, but I don't know where to do
David> that.

See the senders of #registerOpenCommand:, who are primarily sending
it to TheWorldMenu singleton.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Browser Menus

Damien Cassou-3
In reply to this post by David Zmick
Hi David,

On Wed, Mar 5, 2008 at 12:18 AM, David Zmick <[hidden email]> wrote:
> Where can I edit the menu that opens in the default squeak-dev image
> browser?  I want to add an button to it, but I don't know where to do that.
> also, I am very new to morphic, so I might be having a hard time because I
> am not familiar with the common structure of things.


The default browsers in squeak-dev images are OmniBrowser based. In
OmniBrowser, we don't create menus, we install commands. To install a
new command:

- Create a class which inherits from OBCommand
- Implement #isActive, #execute and #label (look at the other subclasses)
- In OBCodeBrowser implement a method whose name starts with 'cmd'
which returns the class you've just created.
- Open a new browser

--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Browser Menus

David Zmick
Ok, I have played around a little more, and I found a method OBTextPanel>>yellowButtonMenu, where I was able to get the "button" in the right place, but I can't figure out the correct action for it :(.  I am not sure if we are thinking of the same thing,  If you need any clarification of my problem, I would be more than happy to explain it to you better :)

On Wed, Mar 5, 2008 at 1:10 AM, Damien Cassou <[hidden email]> wrote:
Hi David,

On Wed, Mar 5, 2008 at 12:18 AM, David Zmick <[hidden email]> wrote:
> Where can I edit the menu that opens in the default squeak-dev image
> browser?  I want to add an button to it, but I don't know where to do that.
> also, I am very new to morphic, so I might be having a hard time because I
> am not familiar with the common structure of things.


The default browsers in squeak-dev images are OmniBrowser based. In
OmniBrowser, we don't create menus, we install commands. To install a
new command:

- Create a class which inherits from OBCommand
- Implement #isActive, #execute and #label (look at the other subclasses)
- In OBCodeBrowser implement a method whose name starts with 'cmd'
which returns the class you've just created.
- Open a new browser

--
Damien Cassou




--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Browser Menus

Colin Putney

On 5-Mar-08, at 3:42 PM, David Zmick wrote:

> Ok, I have played around a little more, and I found a method  
> OBTextPanel>>yellowButtonMenu, where I was able to get the "button"  
> in the right place, but I can't figure out the correct action for  
> it :(.  I am not sure if we are thinking of the same thing,  If you  
> need any clarification of my problem, I would be more than happy to  
> explain it to you better :)

Hi David,

Damien is right - you'll be much better off writing a command than  
messing with #yellowButtonMenu. #yellowButtonMenu is just a hack to  
tap into the existing implementations of cut, paste, find etc, and  
avoid rewriting all that as commands. If you're creating something  
new, subclassing OBCommand is a much better way to go.

Colin

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Browser Menus

David Zmick
So, do I need to do something different if I want to add this function to ALL "text holders" in squeak.  Is there a place were I could one morph, and get it to change all of them?  I would like to be able to also use this in a workspace, debugger, etc..

On Wed, Mar 5, 2008 at 8:09 PM, Colin Putney <[hidden email]> wrote:

On 5-Mar-08, at 3:42 PM, David Zmick wrote:

> Ok, I have played around a little more, and I found a method
> OBTextPanel>>yellowButtonMenu, where I was able to get the "button"
> in the right place, but I can't figure out the correct action for
> it :(.  I am not sure if we are thinking of the same thing,  If you
> need any clarification of my problem, I would be more than happy to
> explain it to you better :)

Hi David,

Damien is right - you'll be much better off writing a command than
messing with #yellowButtonMenu. #yellowButtonMenu is just a hack to
tap into the existing implementations of cut, paste, find etc, and
avoid rewriting all that as commands. If you're creating something
new, subclassing OBCommand is a much better way to go.

Colin




--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Browser Menus

Colin Putney

On 5-Mar-08, at 6:13 PM, David Zmick wrote:

> So, do I need to do something different if I want to add this  
> function to ALL "text holders" in squeak.  Is there a place were I  
> could one morph, and get it to change all of them?  I would like to  
> be able to also use this in a workspace, debugger, etc..

I see. This part of Squeak is kind of ugly - hence the hack in  
OmniBrowser. Take a look at ParagraphEditor and StringHolder. You'll  
need to modify both OB and the "regular" behavior in StringHolder.

Colin


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Browser Menus

David Zmick
ok, i am having a little trouble understanding how the OB Framework works, but I will figure it out eventually.

Thank you very much

On Wed, Mar 5, 2008 at 8:39 PM, Colin Putney <[hidden email]> wrote:

On 5-Mar-08, at 6:13 PM, David Zmick wrote:

> So, do I need to do something different if I want to add this
> function to ALL "text holders" in squeak.  Is there a place were I
> could one morph, and get it to change all of them?  I would like to
> be able to also use this in a workspace, debugger, etc..

I see. This part of Squeak is kind of ugly - hence the hack in
OmniBrowser. Take a look at ParagraphEditor and StringHolder. You'll
need to modify both OB and the "regular" behavior in StringHolder.

Colin





--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com