Undo/Redo in dialogs
All  1-3  4-6

Previous
Next
 From:  ttype (STRUBE)
7286.4 In reply to 7286.2 
I've appended this, your example and added just the first line at the beginning of the script inside the body, hoping that that would change MoI's event policy. But either nothing happens or the script console is not opening at all and MoI crashes afterwards on closing.

Codemirror, which I use, btw has its' own undo/redo functionality that works when I assign a shortcut key that is not used by MoI.

code:
moi.command.registerCommandSpecificShortcutKey( "Ctrl+Z" );
while(1) {
    moi.ui.commandDialog.waitForEvent();
    e  = moi.ui.commandDialog.event;
    if ( e == 'Ctrl+Z' ) {
        editor.undo();
    }
}
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Message 7286.5 deleted 3 Mar 2015 by STRUBE

Previous
 From:  ttype (STRUBE)
7286.6 
I got it!

Because codemirror has its' own undo/redo functionality objects can be added to commandbar like in FullScreen.js and then I simply set up a new shortcut for CTRL+Z and Y that checks if the editor has focus.
code:
var cb = moi.ui.getUIPanel('moi://ui/CommandBar.htm');
cb.consoleDoc = document;
cb.editor = editor;

$(window).unload(function() {
    delete cb.consoleDoc;
    delete cb.editor;
});

code:
var cb = moi.ui.getUIPanel('moi://ui/CommandBar.htm');

if (cb.consoleDoc && cb.consoleDoc.hasFocus()) {
    cb.editor.undo()
} else {
    moi.command.undo();
}

So now there is a small script console with syntax highlighting, line numbers, undo/redo and bracket matching. Still not too much, but it can be found here: https://github.com/thetumbledtype/moi3d-scripts-other/blob/master/ScriptConsole.htm

EDITED: 3 Mar 2015 by STRUBE

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-3  4-6