diff --git a/direct/src/gui/DirectEntry.py b/direct/src/gui/DirectEntry.py index 643dd63fec..6629f7b86a 100644 --- a/direct/src/gui/DirectEntry.py +++ b/direct/src/gui/DirectEntry.py @@ -28,6 +28,8 @@ class DirectEntry(DirectFrame): ('width', 10, self.setup), ('numLines', 5, self.setup), ('focus', 0, self.setFocus), + ('cursorKeys', 0, self.setCursorKeysActive), + ('backgroundFocus', 0, self.setBackgroundFocus), # Text used for the PGEntry text node # NOTE: This overrides the DirectFrame text option ('initialText', '', INITOPT), @@ -81,12 +83,15 @@ class DirectEntry(DirectFrame): def setup(self): self.node().setup(self['width'], self['numLines']) - def setFont(self): - self.onscreenText.setFont(self['font']) - def setFocus(self): PGEntry.setFocus(self.guiItem, self['focus']) + def setCursorKeysActive(self): + PGEntry.setCursorKeysActive(self.guiItem, self['cursorKeys']) + + def setBackgroundFocus(self): + PGEntry.setBackgroundFocus(self.guiItem, self['backgroundFocus']) + def setRolloverSound(self): if base.wantSfx: rolloverSound = self['rolloverSound'] @@ -106,4 +111,11 @@ class DirectEntry(DirectFrame): def get(self): return self.guiItem.getText() + def setCursorPosition(self, pos): + if (pos < 0): + self.guiItem.setCursorPosition(len(self.get()) + pos) + else: + self.guiItem.setCursorPosition(pos) + + diff --git a/direct/src/gui/DirectGui.py b/direct/src/gui/DirectGui.py index 58667a5872..33cfa9831b 100644 --- a/direct/src/gui/DirectGui.py +++ b/direct/src/gui/DirectGui.py @@ -4,6 +4,7 @@ from DirectGuiGlobals import * import __builtin__ __builtin__.guiTop = aspect2d.attachNewNode(PGTop('DirectGuiTop')) guiTop.node().setMouseWatcher(base.mouseWatcherNode) +base.mouseWatcherNode.addRegion(PGMouseWatcherBackground()) # Set up default font PGItem.getTextNode().setFont(getDefaultFont()) diff --git a/direct/src/gui/DirectGuiGlobals.py b/direct/src/gui/DirectGuiGlobals.py index bbf49bf4f8..c8148be428 100644 --- a/direct/src/gui/DirectGuiGlobals.py +++ b/direct/src/gui/DirectGuiGlobals.py @@ -51,6 +51,9 @@ B3RELEASE = PGButton.getReleasePrefix() + MouseButton.three().getName() + '-' # For DirectEntry widgets OVERFLOW = PGEntry.getOverflowPrefix() ACCEPT = PGEntry.getAcceptPrefix() + KeyboardButton.enter().getName() + '-' +TYPE = PGEntry.getTypePrefix() +ERASE = PGEntry.getErasePrefix() + # For setting the sorting order of a widget's visible components IMAGE_SORT_INDEX = 10