This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-03-28 15:41:01

Devloper123
Scratcher
Registered: 2011-11-27
Posts: 100+

Menu adding

I just want to add a mesh menu


http://i45.tinypic.com/2jafczs.gifAnd Dev! Sign up on this forum!i like the  tongue  emoticon

Offline

 

#2 2013-03-28 20:55:20

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Menu adding

Look at ScratchFrameMorph createMenuPanel and ScratchFrameMorph editMenu:, which should show you how Scratch does menus.


nXIII

Offline

 

#3 2013-03-29 17:47:50

davidkt
Scratcher
Registered: 2011-11-09
Posts: 100+

Re: Menu adding

OK go to Scratch-UI-Panes > ScratchFrameMorph> initialization> createMenuPanel and put

Code:

(Mesh             meshMenu:)

under similar ones for File and Edit.
Then accept and go to Scratch-UI-Panes> ScratchFrameMorph> menu/button actions and put

Code:

meshMenu: t1 
    | t2 |
    t2 _ CustomMenu new.
    t2 add: 'Go To Scratch Website' action: #launchScratchWebsite.
    true ifTrue: [self addServerCommandsTo: t2].
    t2 localize.
    #(1 2 ) do: [:t3 | t2 labels at: t3 put: ((t2 labels at: t3)
                copyFrom: 1 to: (t2 labels at: t3) size - 1)
                , ScratchTranslator ellipsesSuffix].
    t2 invokeOn: self at: t1 bottomLeft + (0 @ 10)

in. accept and restart scratch. Then your mesh menu should be right there!
http://i.imgur.com/9gvaefW.png
Note:This is coming from a guy who doesn't even know Smalltalk!?!

Last edited by davidkt (2013-03-29 18:03:12)


I'm Upsilon920 for everything else.
http://www.blocks.scratchr.org/API.php?action=text&string=I_am_currently_&bgr=123&bgg=132http://blocks.scratchr.org/API.php?user=davidkt&action=onlineStatus&type=squarehttp://blocks.scratchr.org/API.php?user=davidkt&action=onlineStatus&type=text

Offline

 

Board footer