YCAMInterlab / ofxTimeline

lightweight timeline tools for openFrameworks
271 stars 141 forks source link

can't compile in Visual Studio 0.9.3 | ofxTextInputField | getCocoaWindow ERRORS #135

Open moebiussurfing opened 8 years ago

moebiussurfing commented 8 years ago

Error 'getCocoaWindow': is not a member of 'ofAppBaseWindow' example-multiTimeline
Severity Code Description Project File Line Suppression State Error 'ofxTextInputField::isEditing': cannot access protected member declared in class 'ofxTextInputField' example-multiTimeline C:\Users\manu\Documents\of_v0.9.3_vs_release\addons\ofxTimeline\src\ofxTLFlags.cpp 104 etc..

there's any way to solve this and use the addon on Windows?

bensnell commented 8 years ago

I've been having problems getting it to build with openAL32.dll, but two problems you mentioned I seemed to fix by

oneandonlyoddo commented 8 years ago

Where would I get this "latest" version of ofxTextInputField? Can't seem to find it anywhere. //Edit: I actually have it. However I can't type in text for Flags. Tried ofxTextInputField on its own and it works. I looked a the commits for updating ofxTimeline towards the latest version of ofxTextInputField and I can't see why it wouldn't work.

oneandonlyoddo commented 8 years ago

Reason why the TextInputField doesn't work is because it doesn't get keypressed events. You can set up the event listeners for TextInputField by calling setup() or setUseListeners(true) on it upon creation in ofxTLFlags.cpp 185-189. However this leads to problems in deleting flags as the TextInputField in the just deleted flag sometimes reacts to the delete key even if you disable the listeners again upon deletion. I ended up fixing it by simply passing the keypressed args of the flag to the TextInputField when editing.

ofxTLFlags.cpp 168-184

void ofxTLFlags::keyPressed(ofKeyEventArgs& args){
    if(enteringText){
        //enter key submits the values
        //This could be done be responding to the event from the text field itself...
        if(args.key == OF_KEY_RETURN){
            enteringText = false;
            timeline->dismissedModalContent();
            timeline->flagTrackModified(this);
        }
        clickedTextField->textField.keyPressed(args); // <-- Line I added to pass the key args to the TextInputField
    }
    //normal behavior for nudging and deleting and stuff
    else{
        ofxTLBangs::keyPressed(args);
    }    
}