make pressing enter work properly in the sprite w and h fields

This commit is contained in:
Jeremy Penner 2011-10-08 14:57:33 -04:00
parent dd5e1f7984
commit 127bae1500

View file

@ -713,13 +713,15 @@ class LobbyI(TokenClient):
except: except:
return "" return ""
def MiTypein_MiButton(self, stBtnLabel, stMiTypein, dgOnSelect): def MiTypein_MiButton_DgNew(self, stBtnLabel, stMiTypein, dgOnSelect):
def NewI(stName = None): def NewI(stName):
if stName == None:
stName = self.miCmds.Value(stMiTypein) stName = self.miCmds.Value(stMiTypein)
if stName != "": if stName != "":
dgOnSelect(stName) dgOnSelect(stName)
return (MiTypein(NewI, stMiTypein), MiButton(stBtnLabel, NewI)) return (MiTypein(NewI, stMiTypein), MiButton(stBtnLabel, NewI), NewI)
def MiTypein_MiButton(self, stBtnLabel, stMiTypein, dgOnSelect):
return self.MiTypein_MiButton_DgNew(stBtnLabel, stMiTypein, dgOnSelect)[:2]
class LobbyBoard(LobbyI): class LobbyBoard(LobbyI):
def InitPersistent(self, owner, client, project, drawing = None): def InitPersistent(self, owner, client, project, drawing = None):
@ -728,10 +730,10 @@ class LobbyBoard(LobbyI):
def CreateMiCmds(self): def CreateMiCmds(self):
miTypeinBoard, miBtnNewBoard = self.MiTypein_MiButton("New Board", "BoardName", self.NewBoard) miTypeinBoard, miBtnNewBoard = self.MiTypein_MiButton("New Board", "BoardName", self.NewBoard)
miTypeinSpr, miBtnNewSpr = self.MiTypein_MiButton("New Sprite", "SpriteName", self.NewSprite) miTypeinSpr, miBtnNewSpr, dgNewSprite = self.MiTypein_MiButton_DgNew("New Sprite", "SpriteName", self.NewSprite)
miTypeinW = MiTypein(self.NewSprite, "w") miTypeinW = MiTypein(dgNewSprite, "w")
miTypeinW.SetValue("1") miTypeinW.SetValue("1")
miTypeinH = MiTypein(self.NewSprite, "h") miTypeinH = MiTypein(dgNewSprite, "h")
miTypeinH.SetValue("1") miTypeinH.SetValue("1")
self.miDimensions = MiMenuHoriz([MiStatic("W:"), miTypeinW, MiStatic("H:"), miTypeinH]) self.miDimensions = MiMenuHoriz([MiStatic("W:"), miTypeinW, MiStatic("H:"), miTypeinH])