It is currently 06 Sep 2025, 21:25
   
Text Size

r22950/r22957 - FTextField ghost text and other tweaks

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

r22950/r22957 - FTextField ghost text and other tweaks

Postby drdev » 18 Aug 2013, 19:16

Just wanted to give a heads up that, as part of my ItemManager work, I made a couple improvements to FTextField:

-Added ghostText property, settable with FTextField.Builder().ghostText() or field.setGhostText(), that can be used to configure text to display in a field when its empty, using a slightly lighter text color. By default, this ghost text is hidden when the field receives focus and reshown when focus is lost (as long as the field is still empty), but I also added a showGhostTextWithFocus property that, if set, allows the ghost text to be shown even with focus (until typing something), which is particularly helpful for a field that receives focus by default. I used this ghost text property to make the Card Catalog search field display "Search" when its empty, as well as cleanup the logic that previously was used to display "[New Deck]" in the Current Deck pane. Ghost text can be useful for displaying a "label" for a field without occupying additional screen real estate. Note that ghostText is completely separate from the text property, so even if its currently displayed, field.getText() will return "". This makes the logic cleaner, as well as allowing typing text that's the same as the ghost text and being able to tell the difference, such as allowing "[New Deck]" to be entered as a deck name without being prompted to enter a deck name.

-Made all fields select all text when they receive focus, taking the logic previously used by the Card Catalog and moving it into FTextField. I believe this behavior is desirable for all fields, though if you think any fields should not do this, I'd be happy to add another FTextField property to turn it off.

-Decreased padding of text fields to reduce their height to that of the buttons on the Card Catalog screen.

Let me know if you have any questions or concerns.

Thanks.
-Dan
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 54 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 54 users online :: 0 registered, 0 hidden and 54 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 54 guests

Login Form