diff options
Diffstat (limited to 'byob.js')
| -rw-r--r-- | byob.js | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -2296,6 +2296,7 @@ InputSlotDialogMorph.prototype.init = function ( // additional properties: this.fragment = fragment || new BlockLabelFragment(); + this.textfield = null; this.types = null; this.slots = null; this.isExpanded = false; @@ -2397,6 +2398,8 @@ InputSlotDialogMorph.prototype.addBlockTypeButton = BlockDialogMorph.prototype.addBlockTypeButton; InputSlotDialogMorph.prototype.setType = function (fragmentType) { + this.textfield.choices = fragmentType ? null : this.symbolMenu; + this.textfield.drawNew(); this.fragment.type = fragmentType || null; this.types.children.forEach(function (c) { c.refresh(); @@ -2487,6 +2490,7 @@ InputSlotDialogMorph.prototype.open = function ( var txt = new InputFieldMorph(defaultString), oldFlag = Morph.prototype.trackChanges; + txt.choices = this.symbolMenu; Morph.prototype.trackChanges = false; this.isExpanded = this.isLaunchingExpanded; txt.setWidth(250); @@ -2495,6 +2499,7 @@ InputSlotDialogMorph.prototype.open = function ( if (pic) {this.setPicture(pic); } this.addBody(txt); txt.drawNew(); + this.textfield = txt; this.addButton('ok', 'OK'); if (!noDeleteButton) { this.addButton('deleteFragment', 'Delete'); @@ -2509,6 +2514,19 @@ InputSlotDialogMorph.prototype.open = function ( this.changed(); }; +InputSlotDialogMorph.prototype.symbolMenu = function () { + var symbols = [], + symbolColor = new Color(100, 100, 130), + myself = this; + SymbolMorph.prototype.names.forEach(function (symbol) { + symbols.push([ + [new SymbolMorph(symbol, myself.fontSize, symbolColor), symbol], + '$' + symbol + ]); + }); + return symbols; +}; + InputSlotDialogMorph.prototype.deleteFragment = function () { this.fragment.isDeleted = true; this.accept(); |
