Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Easier way to open Object Properties Dialog?

Questions related to using nuBuilder Forte.
Post Reply
amit
Posts: 36
Joined: Sat Jun 02, 2018 1:26 pm

Easier way to open Object Properties Dialog?

Unread post 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.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Easier way to open Object Properties Dialog?

Unread post by admin »

amit,

Sorry, we won't be doing that.


Steven
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: Easier way to open Object Properties Dialog?

Unread post 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);
}
amit
Posts: 36
Joined: Sat Jun 02, 2018 1:26 pm

Re: Easier way to open Object Properties Dialog?

Unread post 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!
Post Reply