|
CONTENTS DELETED
The author has deleted this message.
|
|
Good idea :)
but imo, it shouldn't be a subclass of SimpleButtonMorph. I think a class representing the model is more appropriate. Ben On Nov 28, 2011, at 10:08 PM, Ted F.A. van Gaalen wrote: Hi there |
|
CONTENTS DELETED
The author has deleted this message.
|
|
Because it's not a specific button, it's a simple button used in a specific way
Ben On Nov 28, 2011, at 10:44 PM, Ted F.A. van Gaalen wrote: Hi Ben |
|
CONTENTS DELETED
The author has deleted this message.
|
|
Here, you are not changing the mechanism of the button, you are connecting a button to a model (when i click, i turn on/off fullscreen).
It's not a specific button (like a dunno, a button with 3 different states or stgh else). Your button is a classical one, but you want a specific model to plug your button with :) If you want, I could do a little piece of code to show what i mean :) Ben On Nov 28, 2011, at 11:03 PM, Ted F.A. van Gaalen wrote: Could you be more elaborate on this, Ben? |
|
In two words, Ben means to use composition over inheritance :P.
Guille On Mon, Nov 28, 2011 at 7:10 PM, Benjamin <[hidden email]> wrote:
|
|
CONTENTS DELETED
The author has deleted this message.
|
|
Administrator
|
In reply to this post by Ted F.A. van Gaalen
Here's a class-side method I use to add such a button to the world menu: fullscreenMenuOn: aBuilder <worldMenu> (aBuilder item: #'Toggle Fullscreen') action:[ Display toggleFullScreen ]. You can now use Keymapping to use whatever shortcut you want for any action. How about: Morph class>>buildKeymappingsOn: aBuilder <keymap> (aBuilder shortcut: #toggleFullscreen) category: #Fullscreen default: $l command "I couldn't test Fn-11 because the Mac system uses it" do: [ :morph :event | Display toggleFullScreen ]. aBuilder attachShortcutCategory: #Fullscreen to: Morph. HTH, Sean
Cheers,
Sean |
|
In reply to this post by Ted F.A. van Gaalen
Here is a little example of what I meant :)
Ben On Nov 28, 2011, at 11:28 PM, Ted F.A. van Gaalen wrote: Hi Guille, Ben |
|
Why not subclassing?
As a general answer I'd say: Subclassing is a very strong (and static) relationship, and in Pharo we have only single inheritance + traits, so inheritance is a single shot gun :). Splitting the behavior from the button opens you a door in your design. You can design button actions with shortcuts, or undo actions, and choose your own inheritance criteria suiting your needs. Just that, it lets an open door for richer designs. Now, the ammount of code for one or other solution is pretty the same too, you just add one class with the toggle behavior the first one inherits from Button and the other does not), and then the instantiation code should not differ too much. Bye, Guille On Tue, Nov 29, 2011 at 12:52 PM, Benjamin <[hidden email]> wrote:
|
|
In reply to this post by Ted F.A. van Gaalen
On Mon, Nov 28, 2011 at 6:08 PM, Ted F.A. van Gaalen <[hidden email]> wrote: Hi there You can load KeyMappings and define a shortcut for that. It is really really easy to add the shortcut once the functionality is working. Of course, once Keymappins is integrated in Pharo 1.4 and if the rest is interested as well, we can put it by default in pharo :)
-- Mariano http://marianopeck.wordpress.com |
|
In reply to this post by Sean P. DeNigris
I can put this in any class i like, right? What would be a good place? H. |
|
Administrator
|
Yes. I have a class that holds all my image customizations, so I put it there.
Cheers,
Sean |
|
In reply to this post by Mariano Martinez Peck
CONTENTS DELETED
The author has deleted this message.
|
|
Administrator
|
Happy Holidays: (PluggableButtonMorph on: [ Display toggleFullScreen ] getState: nil action: #value) label: 'Toggle Fullscreen'; openInWorld.
Cheers,
Sean |
|
On 03 Dec 2011, at 03:09, Sean P. DeNigris wrote: > Happy Holidays: > (PluggableButtonMorph on: [ Display toggleFullScreen ] getState: nil > action: #value) > label: 'Toggle Fullscreen'; > openInWorld. This is really cool, thx! IMHO something like this should be standard (maybe activateable in settings), preferrably with two state icons like http://www.apple.com/macosx/whats-new/full-screen.html Sven |
|
On Dec 3, 2011, at 12:29 PM, Sven Van Caekenberghe wrote: > > On 03 Dec 2011, at 03:09, Sean P. DeNigris wrote: > >> Happy Holidays: >> (PluggableButtonMorph on: [ Display toggleFullScreen ] getState: nil >> action: #value) >> label: 'Toggle Fullscreen'; >> openInWorld. > > This is really cool, thx! > > IMHO something like this should be standard (maybe activateable in settings), preferrably with two state icons like > > http://www.apple.com/macosx/whats-new/full-screen.html > For the two state icons, you can use ToggleIconicButton from NautilusCommon. So maybe we should push it into the system :) Ben > Sven > > |
| Powered by Nabble | Edit this page |
