Page 1 of 1

Easier way to open Object Properties Dialog?

Posted: Sat Apr 25, 2020 12:22 pm
by amit
Hi guys,

To display the object properties of an object, you can double-click on the corresponding object. For buttons, display objects, HTML etc. this is not possible. In this case you have to use the rather cumbersome way via the Form Object List, search for the object etc.
Can you make it so that when you click on an object with the middle mouse button, the dialog object properties will open? This would greatly simplify the editing of objects.

Re: Easier way to open Object Properties Dialog?

Posted: Mon Apr 27, 2020 1:21 am
by admin
amit,

Sorry, we won't be doing that.


Steven

Re: Easier way to open Object Properties Dialog?

Posted: Mon Apr 27, 2020 7:54 am
by kev1n
Hi amit,

That's an excellent idea! As I like to work in the least complicated way possible, here's what you are looking for.

All you have to do is paste this JavaScript in the (Setup->) Header field.

Middle-click on an object: Will open the "Object Properties" dialog.
Middle-click not on an object (html body etc): Will open the "Form Properties" dialog.

Code: Select all

function getObjIdFromId(id) {

    if (id !== null) {

        var f = window.nuSERVERRESPONSE;
        var objId;
        for (var i = 0; i < f.objects.length; i++) {
            if (f.objects[i].id == id) {
                objId = f.objects[i].object_id;
                return objId;
            }
        }
    }

    return null;
}


function handleMiddleClick(e) {

    if (window.global_access) {
        if (e.button === 1) {

            var id = e.target.id;

            if (id == "nubody" || id == "nuRECORD" || id == "nuhtml") {
                // Form Properties
                nuForm('nuform', window.nuFORM.getCurrent().form_id, '', '', 2);
            } else {
                var objId = getObjIdFromId(e.target.id);
                if (objId !== null) {
                    // Object Properties
                    nuForm('nuobject', objId, '', '', '2');
                }
            }
        }
    }

}

function nuOnLoad() {
    document.addEventListener("mousedown", handleMiddleClick, false);
}

Re: Easier way to open Object Properties Dialog?

Posted: Sun May 10, 2020 4:58 pm
by amit
admin wrote:amit,
Sorry, we won't be doing that.
Steven
I see. You got a better idea?

@Kev1n: Thanks, that's brilliant!