Skip to content

TUITextView and TUITextRenderer #99

Closed
avaidyam opened this Issue Feb 25, 2012 · 4 comments

3 participants

@avaidyam

I've been trying to get TUITextView to scroll properly like NSTextView, and I decided to start by switching TUITextRender to subclass TUIView... anyone want to point me on what I should do next? The entire architecture of TwUI is completely different than both UIKit and AppKit.

@mrjjwright

I also am set to do this. I will let you know if I get it working. It involves enclosing the TUITextView inside a TUIScrollView and setting the contentHeight of the TUIScrollView as the user types by using the text renderer to measure the string. It really shouldn't be that hard but I could be wrong.

@avaidyam

I've tried manually offsetting the frame- doesn't work. I've tried switching the superclass to TUIScrollView- it half works in the sense that everything was borked and I didn't bother fixing the views and layouts. iOS and Cocoa both subclass from scroll views, so why is TwUI subclassing TUIControl...?

@avaidyam

Alright- quick update: Looks like modifying TUITextRenderer is a horrible idea, and so is manually scrolling, like in the TUITextField. What I tried to do did not work well because the cursor started floating in random places and the there was odd text margins, and worst of all, the text didn't scroll back up or down after the bounds were exceeded. How do other implementations do it? It looks like AppKit, UIKit, and Chameleon all subclass a scroll view....

@avaidyam
avaidyam commented Apr 2, 2012

Oh! Someone's done it. Just found the branch: https://github.com/michaelvillar/twui

Next step, making all of this happen without putting the text view inside a scroll view...

@joshaber joshaber closed this May 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.