ianharrigan / haxeui

IMPORTANT NOTE! This repository is no longer maintained. Please consider the newer version: https://github.com/haxeui/haxeui-core
http://haxeui.org/
392 stars 47 forks source link

Combine selectable & mouseEnabled properties for Text's #74

Closed ianharrigan closed 10 years ago

tiagolr commented 10 years ago

Hey, it would be great to provide access to the underlying textField, so one can change text alignment, selectable, mouseEnabled and all that.

ianharrigan commented 10 years ago

Yeah, it might not be a bad idea, the only thing is i think it should be wrapped up around something, just in case, eventually, haxeui wants to support multiple back ends (ie, nme... or a opengl implementation of somekind). That said, already the openfl sprite class would stop that being easy, still, i think i might be better to simply return a https://github.com/ianharrigan/haxeui/blob/master/src/haxe/ui/toolkit/text/ITextDisplay.hx...

tiagolr commented 10 years ago

Sounds good, but then it would be useful to add all current textField properties to it, or at least the majority of them, i could use a couple of them already namely textAlign.

ianharrigan commented 10 years ago

Good call, i think probably text align should probably make it so that it is visible to the actual Text component also (so you can use it in the xml)... i go over the interface and all add the relevant bits and then see which ones make sense to bring up to the Text component.

ianharrigan commented 10 years ago

These are the props i found on the flash text field that i think would be usedful:

I couldnt actually find a text align, still i think it would be a useful one to add (im sure it can be done by simply getting the default style and changing the alignment of it)

tiagolr commented 10 years ago

restrict only works for flash target.

text align and others are part of text format, allowing one to change text format of textfields and textinput would be invaluable, again not sure if its better to create a wrap around or not, its some work but may definitely be worth it.

ianharrigan commented 10 years ago

Yeah, so i think adding a textAlign to the interface would work by then taking the current text format and then changing the alignment. But you would have an easy property to change it (instead of messing with the text format yourself). I think restrict is also a nice one to move over, it may only work for flash, but thats fine, it means its is there... And if the back end changes, then it might be able to be implemented by any new backend... im taking a look at them now quickly...

tiagolr commented 10 years ago

Yes, exposing textFormat would do the trick, StablexUI does it nicely by having a TextFormat inside the Text component that updates textfield format when the widget is refreshed (equivalent to invalidate() in haxeui)

https://github.com/RealyUniqueName/StablexUI/blob/master/src/ru/stablex/ui/widgets/Text.hx

Can't reemember how the xml works but never had a limitation with that. Stablexui uses almost a xml language that allows to access lots of stuff, but it may be possible without that using something a wrapper or something clever.

ianharrigan commented 10 years ago

mouseEnabled has been dropped and now only "selectable" is available.

Also, two new properties for textinputs: