Skip to content

PGEntry getCursorY fails on word-wrapped or multiline text #1633

Description

@DoctorAxiom

Description

For a multiline use of a PGEntry, the getCursorY() function returns 0 no matter where the cursor is positioned.

Steps to Reproduce

In short, create a PGEntry with a fixed width and number of lines greater than 1. move the cursor to the second line. getCursorY still shows

Example code snippet:

inputbox = DirectEntry(parent=aspect2d,
                                     width=1.0,
                                     numLines=50 )
inputbox.enterText('Hello, this text should span multiple lines in the PGEntry handling the DirectGUI object that we are testing')

print('Cursor X:', inputbox.guiItem.getCursorX(), 'Cursor Y:', inputbox.guiItem.getCursorY() )

subsequently you can run

inputbox.guiItem.setCursorPosition(0)

print('Cursor X:', inputbox.guiItem.getCursorX(), 'Cursor Y:', inputbox.guiItem.getCursorY() )

to compare the Y when the cursor is at the beginning of the direct entry.

Despite the cursor being displayed at very different Y levels, getCursorY returns 0 at all times.

Environment

  • Operating system: Windows 11
  • System architecture: x64
  • Panda3D version: 1.10.14
  • Installation method: pip
  • Python version (if using Python): 3.9.7
  • Compiler (if using C++): n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions