Lively Kernel canvas
//
DraftNewPromptDialog40
WeneedabetterPromptDialogthatscaleswell...Sowetryoutthetheconnectmechanism181
-----falsetruefalse0
fontCourier12:spacewidth7from21xWidth7falsetruefalse0
worldis1:WorldMorph([[0,0,2000,1200]])falsetruefalse0
startingWikiNavigatorfalsetruefalse0
status207onPROPFINDhttp://lively-kernel.org/repository/webwerkstatt/draft/DraftPromptDialog.xhtmlfalsetruefalse0
http://lively-kernel.org/repository/webwerkstatt/draft/../anonymous_module_3loadedin75msfalsetruefalse0
http://lively-kernel.org/repository/webwerkstatt/draft/../anonymous_module_2loadedin854msfalsetruefalse0
fontHelvetica40:spacewidth11from51xWidth20falsetruefalse0
fontHelvetica18:spacewidth5from23xWidth9falsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
ResizingSVGcanvasfalsetruefalse0
Moduleloadcheckdone.31modulesloaded.falsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalse0
oncancelfalsetruefalse0
-------------------------------------------falsetruefalse0
invoke1:WorldMorph([[0,0,2000,1200]])falsetruefalse0
status200onGEThttp://lively-kernel.org/repository/webwerkstatt/draft/DraftPromptDialog.xhtmlfalsetruefalse0
problemstoparsehttp://lively-kernel.org/repository/webwerkstatt/draft/DraftPromptDialog.xhtmlfalsetruefalse0
extendForSerializationundefinedfalsetruefalse0874.010009765625
-1nullnulltrue0falsetruetruefalse
false1truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetruefalse
truetrue100false
truefalse050
nullfalsetruenullfalse
Consolefalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
HelloWorldfalsenullfalsetruenull
ButtonMorph.addMethods({initialize:function($super,initialBounds){this.baseFill=null;$super(initialBounds);this.value=false;//forconnect()this.isActive=true;if(Config.selfConnect){varmodel=Record.newNodeInstance({Value:this.value,IsActive:this.isActive});//thisdefaultselfconnectionmaygetoverwrittenby,eg,connectModel()...this.relayToModel(model,{Value:"Value",IsActive:"IsActive"});}//Stylingthis.applyLinkedStyles();this.changeAppearanceFor(this.value);returnthis;},})21truetruefalsetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
10000.4065966799002455Wikicontroltrue
10000.03780776881738291Wikicontroltrue
Enterthetextyouwishtofind...falsenullfalse
truetruefalsetruetruefalse
false1truefalsetruetruefalse
Cancelfalsenullfalsefalsetrue
false
OKfalsenullfalsefalsetrue
falsefalse
false
nullfalsetruenullfalse
falsenullfalsetrue15nullfalsefalsenullnullnullnullfalse
10004.100281236537552Wikicontroltrue
/**ReplacementforPromptDialogWidget**///TODO:getridofthemagicandrepetitivelayoutnumbers....BoxMorph.subclass("PromptDialogMorph",{suppressHandles:true,padding:newRectangle(10,10,10,10),connections:['accepted','canceled','title'],//fordocumentationonlyinitialize:function($super,bounds){bounds=bounds||newRectangle(0,0,300,130);$super(bounds);this.callback=null;this.layoutManager=newVerticalLayout();this.addTitle("PromptDialog");this.addTextPane();this.addButtons();this.linkToStyles(["panel"]);this.adjustForNewBounds();},addTitle:function(str){this.label=newTextMorph(newRectangle(0,0,20,10)).beLabel();connect(this,"title",this.label,'setTextString');this.label.padding=newRectangle(0,10,0,0);this.addMorph(this.label);this.title=str;},addTextPane:function(){this.textPane=newTextPane(newRectangle(0,0,300,100),"");this.textPane.applyStyle({fill:Color.white});this.textPane.innerMorph().applyStyle({fill:null});this.textPane.innerMorph().owner.applyStyle({fill:null});//clipthis.addMorph(this.textPane);},addButtons:function(){this.okButton=newButtonMorph(newRectangle(0,0,70,20));this.okButton.setLabel("OK");connect(this.okButton,"fire",this,'removeWithWindow');connect(this.okButton,"fire",this,'onAcceptButtonFire');this.cancelButton=newButtonMorph(newRectangle(0,0,70,20));this.cancelButton.setLabel("Cancel");connect(this.cancelButton,"fire",this,'removeWithWindow');connect(this.cancelButton,"fire",this,'canceled');varpane=newBoxMorph();pane.layoutManager=newHorizontalLayout();pane.padding=newRectangle(5,5,5,5);pane.addMorph(this.cancelButton);pane.addMorph(this.okButton);pane.setBounds(pane.submorphBounds(true));pane.setFill(null);this.addMorph(pane);this.buttonPane=pane;},setText:function(aString){this.textPane.innerMorph().setTextString(aString);},getText:function(){returnthis.textPane.innerMorph().textString},onAcceptButtonFire:function(){this.callback&&this.callback(this.getText());updateAttributeConnection(this,'accepted',this.getText())},adjustForNewBounds:function($super){varnewExtent=this.innerBounds().extent();varoffset=pt(0,0);offset=offset.addPt(pt(0,this.buttonPane.getExtent().y));offset=offset.addPt(pt(0,this.label.getExtent().y));this.textPane.setExtent(newExtent.subPt(offset))this.relayout();//moveButtonsvaroffset=this.shape.bounds().bottomRight().subPt(this.buttonPane.bounds().bottomRight())this.buttonPane.moveBy(offset.subPt(pt(5,5)))},openIn:function(world,loc){varuseLightFrame=true;varwin=world.addFramedMorph(this,'',loc,useLightFrame);this.textPane.innerMorph().requestKeyboardFocus(world.firstHand());win.adjustForNewBounds()returnwin;},removeWithWindow:function(){if(this.owner&&(this.ownerinstanceofWindowMorph)){this.owner.remove()}else{this.remove()}},})//shouldthesegotothetests?Morph.subclass("PromptDialogMorphExampleClientMorph",{oncancel:function(){console.log("oncancel")},onaccept:function(input){console.log("onaccept"+input);}})Object.extend(PromptDialogMorph,{openExample:function(){if($morph('testPromptDialog'))$morph('testPromptDialog').remove();varmorph=newPromptDialogMorph();//morph.openInWorld();varwin=morph.openIn(WorldMorph.current(),pt(550,50));win.setExtent(pt(300,300))win.name='testPromptDialog';//weneedobjectsthatarepersistentandimplementthebehaviorvarclient=newPromptDialogMorphExampleClientMorph(newlively.scene.Rectangle(0,0,1,1));morph.addMorph(client);//storeitsomewhereconnect(morph,'canceled',client,'oncancel');connect(morph,'accepted',client,'onaccept');}})PromptDialogMorph.openExample();this.world().prompt("Howoldareyou?",function(answer){alert("Nextyearyoubecome"+(Number(answer)+1))})truetruefalse147truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
null74