ofxTextField (mac pc)

I finally got around to finish this thing

a utf8 unicode aware textbox attached above our openGl window for Mac and PC

ps:

I wrote this under of 7.0.4 Glut. not tested it with GLFW or of 8.0
it should work but I didn’t have time to test it yet

feel free to modify and improve it.

5 Likes

Woooaah!! awesome!!
I will try it right away!! BTW do you think there is any chance to change background color (in mac)?
I guess transparency will not work right?

Good job! Hurrah!

1 Like

changing colors and other procedural stuff are very easy to adjust, I kind of rushed this one out so people have something to go by, next update is going to be way more polished. hopefully next weekend!

1 Like

UPDATE:
V0.001

Added Support for OF 0.801 and GLFW

previous Version only worked well for mac in OF 007 and had posisioning problems in the official branch.
Fixed now.

Next:

will add more features in the mac version

add a clean bool ofSystemYesNoDialogue()

will be fixing all systemAlert fuctions to work correctly with UTF8 and make a pull request when is all done…

(probably years later with the rhythm I am going)… :frowning:

/// EDIT version 0.002

I noticed a weird behavior on mac when clicking the green button and using fixed position instead of ofGetWidth/2.

Fixed it. by adding a void * to the NSwindow and checking for resizing of screen
also added a function that set min size to the NSwindow so that textbox never goes out of the GlWindow if user tries to resize the window

Nice! thanks for keeping us posted

Hi Friends, Just a minor Update

I’ve finally added multiline ability for both MAC and PC

Added a scroll-bar

scroll-bar listens to mouse-scroll events

in the mac version twofinger gestrue is also enabled

added Hide() show() function for Mac+PC

added getText() for mac and PC

also Added Support for V-Studio

Fixed minor bugs on mac/pc

here is a new video and some pictures

existing functions for you to use

setisMultiline()
show()
hide()
draw()
getText()

coming soon:

setTextMode()
setText() (for the mac version)
setColor()

2 Likes

thanks for the contribution! but when i input chinese, i can only got a ‘?’ both in the input box and in the main gl window.
my config is:
windows 8.1, OF0.8.0, VS2012 with the latest code grabbed from your github
another problem is, the textbox won’t give focus back to the main gl window when i clicked outside the textbox

regarding the focus issue,

create a function in systemUtiils.h
void setFocusToThisWindow();

and in systemUtils.cpp:

void setFocusToThisWindow(){
#ifdef TARGET_WIN32
SetFocus( ofGetWin32Window());
#endif
}

you can then call this in mousePressed in ofApp setFocusToThisWindow()

regarding the other issue, It must be an encoding thing…

is the problem only happening in .getText() function or
it happens when you type in the textField as well…

edit// the thing with encoding is that Chinese on PC usually use utf16… so maybe the returning string must be encoded in a different manner…

I remember checking chinese in CB but not in VS…