Using ACE with WT and highlighting lines. This is not working

103 views Asked by At

This code is not working, I keep having a loading sign on top to the right but the editor works. Is it possible to have some help towards the actual connection from the Ace Editor file to the C++ WT file.

//Start.
editor1 = new Wt::WText(wt_root);
                editor1->setText("Testing for the highlight.");
                editor1->setInline(false);




                //REQUIREMENT FOR THE ACEEDITOR FILE INPUTED.
                Wt::WApplication::instance()->require(std::string("AceFiles/ace.js"));


                //CONFIG FOR THE EDITOR THAT WILL SUPPORT TEXT.
                editor = new Wt::WContainerWidget(wt_root);
                editor->resize(500, 500);

                range = new Wt::WContainerWidget(wt_root);



                //editor_ref IS THE STRING THAT THE USER IS WRITTING.
                std::string editor_ref = editor->jsRef();
                std::string range_ref = range->jsRef();
                std::string command =
                    editor_ref + ".editor = ace.edit(" + editor_ref + ");" +
                    range_ref + ".range = ace.require('ace/range')." + range_ref + ";" +
                    editor_ref + ".editor.setTheme(\"ace / theme / github\");" +
                    editor_ref + ".editor.getSession().setMode(\"ace/mode/assembly_x86\");" +
                    editor_ref + ".editor.session.addMarker(new Range(1, 0, 15, 0), \"fullLine\");";

                editor->doJavaScript(command);

                //CONFIG. FOR THE JSIGNAL USED.
                //BEING THE CONNECTION BETWEEN THE C++ DOC AND THE JAVA SCRIPT. 
                jsignal = new Wt::JSignal<std::string>(editor, "textChanged");
                jsignal->connect(this, &Ui_AceEditor::textChanged);





                //CONFIG FOR THE BUTTON.
                b = new Wt::WPushButton("Save", wt_root);

                command = "function(object, event) {" +
                    jsignal->createCall(editor_ref + ".editor.getValue()") +
                    ";}";

                b->clicked().connect(command);
0

There are 0 answers