My favorites | Sign in
Project Home Downloads Issues
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 276: Solve TextInput problem when text width exceeds textinput.width (make scrollable)?
3 people starred this issue and may be notified of changes. Back to list
Status:  Done
Owner:  txprog
Closed:  Aug 2010


 
Project Member Reported by dennd...@gmail.com, Jul 4, 2010
How could we do this?
A hard character limit isn't a good idea...
What you have in most cases is a 'scrollable' text input field (which might, if you want, expand a little automatically within predefined bounds).
We should do the same.
How, though.

Quick Idea: Use MTList do display text. However, then we don't need to inherit from MTButton, right? Opinions on this? Really not sure how to best implement...
Jul 5, 2010
Project Member #1 dennd...@gmail.com
Should be applicable to both, TextInput AND TextArea.

ALSO: Widgets should still be allowed to grow (as TextArea does right now, for apps like presemt). But if you give it a size_limit, it will go no larger.
Owner: txprog
Aug 17, 2010
Project Member #2 txprog
Usage of stencil for textarea solve the problem, but reduce a lot performance.
{{{
    #
    # Needed to prevent the label go out of the bounds
    #
    def draw_label(self, dx=0, dy=0):
        stencilPush()
        drawRectangle(pos=self.pos, size=self.size)
        stencilUse()
        if self.is_active_input:
            padding = self.padding
            if type(padding) in (list, tuple):
                padding = padding[0]
            dx = -self._used_label.width + self.width + padding
        super(MTTextInput, self).draw_label(dx, dy)
        stencilPop()
}}}


A much deeper solution must be found, since even core Label() can have problem with size.

I've played with texture coordinate, but the problem is taht the text is blur after adjustment.
screenshot0000 is no limitation,
screenshot0001 is with limitation.


Testing other solution...
screenshot0000.jpg
21.4 KB   View   Download
screenshot0001.jpg
13.4 KB   View   Download
Status: Started
Aug 18, 2010
Project Member #3 txprog
scroll and scroll_trigger attribute have been added, default to True and 10. Refer to documentation abotu the behavior.

It still a big changes, since now, cause only a part of Core Label can be drawed. This can be manipulate with viewport_pos and viewport_size on Label().
And MTLabel is now always set the viewport_size, to prevent rendering outside the bounds of the label.
Aug 18, 2010
Project Member #4 txprog
Closed via GitHub: http://github.com/tito/pymt/commit/8a4e8a8f30952645679ff7e0a5ef3e12eba7f846

textinput: add scroll + scroll_trigger property, and rework textinput to add more documentation and make it more understandable (fixes  issue 276 )
Status: Done

Powered by Google Project Hosting