Request - Text editor center alignment


#1

it would be nice to have the text editor be able to center the edited text inside. (useful for controllers)

and perhaps a right to left alignment can be nice for right to left languages.
cheers!

thanks!
Assaf


Vertical alignment in a single-line TextEditor
#2

Yes, I’ve got some code to do that, which I’ve been meaning to merge in…


#3

yay you rock! :smiley:


#4

I just spent time looking for a way to do alignment or justification with a TextEditor component, and came to this thread.

I’d like to second the motion for left, right and center alignment of text.


Msc Project Ideas - Anything JUCE users need?
#5

was this done ? i can’t find anything about justification in the TextEditor class.


#6

I don’t think I ever added it (…?)


#7

could you ? :slight_smile:

or was there a problem and it can’t be done.


#8

I think it was just a bit of a PITA to write, and I never got round to it. It is still there on my to-do-list.


#9

Not to hijack, but what’s the possibility of adding unicode(MLTE) text entry to texteditor? I’d fly to the UK and hug your feet…not much of an incentive i know, but… :wink:


#10

on the subject of PITA, apart from beeing a urban dictionary acronym for pain in the ass it’s also a type of food, that was sold in all theese little booths on the central train station in a town i used to live in. there was like 20-30 of theese booths and they all sold this

it had this white sauce in it, that got everywhere but your mouth. at some point someone got interested in this fenomen (it got very popular) and did a test on what did those PITA sandwiches contain. Apart from the obvious unhealthy chemicals and rotten veggies it also contained some amounts of Sperm, but the most interesting part (if that wasn’t enough) is that it was HORSE sperm (i always thought it would be human, some bored sauce maker person getting off on the job).

I just wanted to tell you that PITA can mean both of theese things.

And it it comes to foot fetish stuff, i offer my services as well.


#11

(I thought that was spelt “pitta”…?)

It’s already unicode, of course - so do you mean right-to-left layout?


#12

Hey Jules. I mean multiple language text input. So if I swap to say hiragana keyboard layout and type puru I get ぷる

the two “western” characters pu make the first symbol and ru the next. It’s not just Asian characters but scandanivian as well (and others needing two or more keystrokes)

on cocoa an nsview is too lowlevel I think(on a keydown). An nstextview works but then we’d lose the functionality of your texteditor. Carbon had an interface that worked without a control but we obviously want to get away from that

i’ll happily spend some time on the mac side if someone wants to suggest windows/Linux trappings(I’d hate to waste time if it couldn’t be rolled into juce platforms)

I’ve seen someone work around it on iPhone by using a hidden nstextview equivalent to trap the events and then forward the Unicode string to the control.


#13

Hey Jules. I mean multiple language text input. So if I swap to say hiragana keyboard layout and type puru I get ぷる

the two “western” characters pu make the first symbol and ru the next. It’s not just Asian characters but scandanivian as well (and others needing two or more keystrokes)

on cocoa an nsview is too lowlevel I think(on a keydown). An nstextview works but then we’d lose the functionality of your texteditor. Carbon had an interface that worked without a control but we obviously want to get away from that

i’ll happily spend some time on the mac side if someone wants to suggest windows/Linux trappings(I’d hate to waste time if it couldn’t be rolled into juce platforms)

I’ve seen someone work around it on iPhone by using a hidden nstextview equivalent to trap the events and then forward the Unicode string to the control.


#14

Sorry about the double post(mobile safari).

From what I know every nswindow has a nstextview that is used for all key entry. When an nstextfield, nstextfieldcell goes into edit mode this controls go visible and moves into position. For the character palette to work(which it currently doesn’t with juce) I’m not sure what the os is looking for. (as a test call up the character palette and try to insert Unicode characters/symbols)

anyway if I find more info I’ll create a new post


#15

NSTextInput Protocol Reference seems to be promising (NSTextInputClient on >10.5). Adding the functions to JuceNSView might do the trick

Apple’s links don’t seem to last long these days but here it is for what its worth

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSTextInput_Protocol/Reference/Reference.html

I might have to do something like this this week…if I do i’ll contribute any code


#16

Thanks - that’s all new to me, I’ll have to take a look.


#17

I’ve hacked something together in NSViewComponentPeer, i’ll send you off list…

It currently looks for the focused component to be able to be dynamically cast to TextEditor before passing the events for interpretation.


#18

Ok, thanks, I’d be interested to see that.


#19

Hi there, just wondering if this was ever added.


#20

yes, me too. Did the code went into the current version ? I would like to be able to center-align and right-align the text in a TextEditor.