Template Button - How do I Change its Appearance?

Hi

  1. min-height:0% in style tags. set it to a pixel value maybe 10px - 15px.
    you dont need any more the overflow:hidden either.
  2. use px instead of % for all sizes for better accuracy, as in my flow above (forgot to mention it in the previous post)

One trick to pinpoint the exact size in pixels is to right click on the image/element and choose "Inspect"
Thats going to select the element in your browser's developer's tools and on the right side you'll see the css styles attached to it.

Double clicking on the pixel value of (lets say background-size) and using the up/down arrows you can increment/decrement the size till you get it right (without scrollbars). Note down the values and apply to the actual code.

Interesting reading!! and looking at!!

screenshot-127.0.0.1_1880-2021.11.11-16_31_14

Although I can adjust the arrow sizes etc, I cant seem to adjust this bit:

(the size of the light red square)

It's almost as if each button is a 1x1 size, no matter what I have tried, the actual "button" itself (or its area allocated to it) does not scale down... Feel so foolish...LOL....

Regds
Ed

Edit:

I will keep it as a % meantime... Layout is still in limbo, % seems to be more flexible, albeit not as accurate

plan B .. change the md-buttons to divs ..

<div style="background-image: url('/png/Up_Arrow_Button.png'); background-repeat: no-repeat; 
   background-color:transparent; background-size: 90% 90%; width: 25px; height: 25px" ng-mousedown="mousedownT($event)"
    ng-mouseup="mouseupT($event)">
</div>

I think I have done it right... See below:

[
    {
        "id": "2b1bfd96912a18a8",
        "type": "ui_template",
        "z": "c5c2730f3af33875",
        "group": "0778f2d6568500cc",
        "name": "Up/Dn + Press - Single Tile 5",
        "order": 4,
        "width": 1,
        "height": 1,
        "format": "<div \nid=\"{{'my_'+$id}}\" \nstyle=\"{{'color:'+theme.base_color}};\nbackground-image: url('/png/Up_Arrow_Button.png'); \nbackground-repeat: no-repeat;\nbackground-color:transparent; \nbackground-size: 100% 25%; \nwidth: 25px; \nheight: 25px\">\n</div>\n\n\n<md-button style=\"background-image: url('/png/Up_Arrow_Button.png'); background-repeat: no-repeat; \n    background-color:transparent; background-size: 100% 25%; button-size: 100% 25%\"\n   ng-mousedown=\"mousedownT($event)\"\n   ng-mouseup=\"mouseupT($event)\">\n</md-button>\n\n<md-button style=\"background-image: url('/png/Dn_Arrow_Button.png'); background-repeat: no-repeat; \n    background-color:transparent;  background-size: 100% 25%; button-size: 100% 25%\"\n    ng-mousedown=\"mousedownB($event)\" \n    ng-mouseup=\"mouseupB($event)\">\n</md-button>\n\n<script>\n    (function(scope) {\n\nscope.mousedownT = function(event) {\nevent.target.style.backgroundImage = \"url('/png/Up_Arrow_Button1.png')\";\n// event.target.style.backgroundRepeat = \"no-repeat\";\n// event.target.style.backgroundSize = \"100% 25%\";\n// event.target.style.buttonSize = \"100% 25%\";\nevent.target.style.color = \"red\";\nscope.send({topic:\"Upper\", payload: true})\n}\n\nscope.mouseupT = function(event) {\nevent.target.style.backgroundImage = \"url('/png/Up_Arrow_Button.png')\";\n// event.target.style.backgroundSize = \"100% 25%\";\n// event.target.style.buttonSize = \"100% 25%\";\nevent.target.style.color = \"blue\";\nscope.send({topic:\"Upper\", payload: false})\n}\nscope.mousedownB = function(event) {\nevent.target.style.backgroundImage = \"url('/png/Dn_Arrow_Button1.png')\";\n// event.target.style.backgroundRepeat = \"no-repeat\";\n// event.target.style.backgroundSize = \"100% 25%\";\n// event.target.style.buttonSize = \"100% 25%\";\nevent.target.style.color = \"red\";\nscope.send({topic:\"Lower\", payload: true})\n}\n\nscope.mouseupB = function(event) {\nevent.target.style.backgroundImage = \"url('/png/Dn_Arrow_Button.png')\";\n// event.target.style.backgroundSize = \"100% 25%\";\n// event.target.style.buttonSize = \"100% 25%\";\nevent.target.style.color = \"blue\";\nscope.send({topic:\"Lower\", payload: false})\n}\n\n})(scope);\n\n</script>",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 170,
        "y": 210,
        "wires": [
            [
                "4ff1e912ccebdb0e"
            ]
        ]
    },
    {
        "id": "0778f2d6568500cc",
        "type": "ui_group",
        "name": "Group 1",
        "tab": "026fcdc7367db27f",
        "order": 1,
        "disp": true,
        "width": 6
    },
    {
        "id": "026fcdc7367db27f",
        "type": "ui_tab",
        "name": "Tab 3",
        "icon": "dashboard",
        "order": 2
    }
]

But still no change...

i mean .. totally replace them as divs .. not to be md-buttons anymore
because its pretty pointless with so many css styling changes to keep them as material-design buttons :wink:

[EDIT] resized % of images and added cursor:pointer css style

[{"id":"251a3e9c2d2fc7cd","type":"ui_template","z":"5847b7aa62131d37","group":"510d1d4036ab811e","name":"Up/Dn + Press - Single Tile 5","order":4,"width":1,"height":1,"format":"\n<div class\"imagebutton\"\nstyle=\"background-image: url('/png/Up_Arrow_Button.png');\ncursor: pointer;\nbackground-repeat: no-repeat;\nbackground-color:transparent;\nbackground-size: 90% 60%; width: 25px; height: 25px\"\nng-mousedown=\"mousedownT($event)\"\nng-mouseup=\"mouseupT($event)\">\n</div>\n\n<div class\"imagebutton\"\nstyle=\"background-image: url('/png/Dn_Arrow_Button.png'); \ncursor: pointer;\nbackground-repeat: no-repeat; \nbackground-color:transparent;  \nbackground-size: 90% 60%; width: 25px; height: 25px\" \nng-mousedown=\"mousedownB($event)\"\nng-mouseup=\"mouseupB($event)\">\n</div>\n\n<script>\n    (function(scope) {\n\nscope.mousedownT = function(event) {\nevent.target.style.backgroundImage = \"url('/png/Up_Arrow_Button1.png')\";\n// event.target.style.backgroundRepeat = \"no-repeat\";\n// event.target.style.backgroundSize = \"100% 25%\";\n// event.target.style.buttonSize = \"100% 25%\";\nevent.target.style.color = \"red\";\nscope.send({topic:\"Upper\", payload: true})\n}\n\nscope.mouseupT = function(event) {\nevent.target.style.backgroundImage = \"url('/png/Up_Arrow_Button.png')\";\n// event.target.style.backgroundSize = \"100% 25%\";\n// event.target.style.buttonSize = \"100% 25%\";\nevent.target.style.color = \"blue\";\nscope.send({topic:\"Upper\", payload: false})\n}\nscope.mousedownB = function(event) {\nevent.target.style.backgroundImage = \"url('/png/Dn_Arrow_Button1.png')\";\n// event.target.style.backgroundRepeat = \"no-repeat\";\n// event.target.style.backgroundSize = \"100% 25%\";\n// event.target.style.buttonSize = \"100% 25%\";\nevent.target.style.color = \"red\";\nscope.send({topic:\"Lower\", payload: true})\n}\n\nscope.mouseupB = function(event) {\nevent.target.style.backgroundImage = \"url('/png/Dn_Arrow_Button.png')\";\n// event.target.style.backgroundSize = \"100% 25%\";\n// event.target.style.buttonSize = \"100% 25%\";\nevent.target.style.color = \"blue\";\nscope.send({topic:\"Lower\", payload: false})\n}\n\n})(scope);\n\n</script>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","className":"","x":580,"y":620,"wires":[["33d54fd75103dac3"]]},{"id":"33d54fd75103dac3","type":"debug","z":"5847b7aa62131d37","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":620,"wires":[]},{"id":"510d1d4036ab811e","type":"ui_group","name":"Group 1","tab":"026fcdc7367db27f","order":1,"disp":true,"width":6},{"id":"026fcdc7367db27f","type":"ui_tab","name":"Tab 3","icon":"dashboard","order":2}]

Thanks Andy!!

I couldn't get your code to work as posted, but it gave me some major steps in the right direction... Copy/Paste/Guess to the Max!!

And it actually worked!!

Here's what I came up with ultimately:

[
    {
        "id": "d52180de48148c7f",
        "type": "ui_template",
        "z": "68e5c71acc43e814",
        "g": "7cdc27954f172ea5",
        "group": "62350f50d4b09ff8",
        "name": "Up/Dn Tile",
        "order": 21,
        "width": 1,
        "height": 1,
        "format": "<div id=\"{{'my_'+$id}}\" style=\"{{'color:'+theme.base_color}}\"></div>\n\n<div class top\nstyle=\"background-image: url('/png/Up_Arrow_Button.png');\n    cursor: pointer;\n    background-repeat: no-repeat;\n    background-color: transparent;\n    background-size: 90% 90%; \n    width: 90%; \n    height: 90%\"\nng-mousedown=\"mousedownT($event)\"\nng-mouseup=\"mouseupT($event)\"\n></div>\n\n<div class bottom\nstyle=\"background-image: url('/png/Dn_Arrow_Button.png');\n    cursor: pointer;\n    background-repeat: no-repeat;\n    background-color: transparent;\n    background-size: 90% 90%;\n    width: 90%; \n    height: 90%\"\nng-mousedown=\"mousedownB($event)\"\nng-mouseup=\"mouseupB($event)\"\n></div>\n\n<script>\n(function(scope) {\n    scope.mousedownT = function(event) {\n        event.target.style.backgroundImage = \"url('/png/Up_Arrow_Button1.png')\";\n        scope.send({topic:\"Top\", payload: true})\n    }\n    scope.mouseupT = function(event) {\n        event.target.style.backgroundImage = \"url('/png/Up_Arrow_Button.png')\";\n        scope.send({topic:\"Top\", payload: false})\n    }\n    scope.mousedownB = function(event) {\n        event.target.style.backgroundImage = \"url('/png/Dn_Arrow_Button1.png')\";\n        scope.send({topic:\"Bottom\", payload: true})\n    }\n    scope.mouseupB = function(event) {\n        event.target.style.backgroundImage = \"url('/png/Dn_Arrow_Button.png')\";\n        scope.send({topic:\"Bottom\", payload: false})\n    }\n})(scope);\n</script>",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 250,
        "y": 2290,
        "wires": [
            [
                "443a53aea21939e3"
            ]
        ]
    },
    {
        "id": "62350f50d4b09ff8",
        "type": "ui_group",
        "name": "Radio",
        "tab": "554e77d51ad13f2d",
        "order": 1,
        "disp": false,
        "width": 24,
        "collapse": false,
        "className": ""
    },
    {
        "id": "554e77d51ad13f2d",
        "type": "ui_tab",
        "name": "PCR1000",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

If I might ask, what does this actually do? [quote="UnborN, post:25, topic:52846"]
added cursor:pointer css style
[/quote]

Now the frequency adjustment looks a hang of a lot better on the front-end:

screenshot-127.0.0.1_1880-2021.11.12-15_29_05

As an offspring from this, do you know whether it is possible to make a button split vertically instead of horizontally? (as in Left/Right arrows, opposed to Up/Down)

Regds
Ed

very nice :+1:

cursor:pointer changes the mouse cursor for the element.
A more complete list here

Try with a container div set to display:flex ? (i can never remember these styles) .. had to look them up
and transform: rotate() ..

Example :

[{"id":"d52180de48148c7f","type":"ui_template","z":"5847b7aa62131d37","group":"62350f50d4b09ff8","name":"Up/Dn Tile","order":21,"width":"2","height":1,"format":"<div id=\"{{'my_'+$id}}\" style=\"{{'color:'+theme.base_color}}\"></div>\n\n\n<div style=\"display:flex; flex-direction:row; width: 100%; height: 100%;\">\n\n    <div \n    style=\"background-image: url('/png/Up_Arrow_Button.png');\n        transform: rotate(-90deg);\n        cursor: pointer;\n        background-repeat: no-repeat;\n        background-color: transparent;\n        background-size: 90% 90%;\n        width: 90%; \n        height: 90%\"\n    ng-mousedown=\"mousedownT($event)\"\n    ng-mouseup=\"mouseupT($event)\"\n    ></div>\n\n    <div \n    style=\"background-image: url('/png/Dn_Arrow_Button.png');\n        transform: rotate(-90deg);\n        cursor: pointer;\n        background-repeat: no-repeat;\n        background-color: transparent;\n        background-size: 90% 90%;\n        width: 90%; \n        height: 90%\"\n    ng-mousedown=\"mousedownB($event)\"\n    ng-mouseup=\"mouseupB($event)\"\n    ></div>\n\n</div> \n\n\n\n<script>\n(function(scope) {\n    scope.mousedownT = function(event) {\n        event.target.style.backgroundImage = \"url('/png/Up_Arrow_Button1.png')\";\n        scope.send({topic:\"Top\", payload: true})\n    }\n    scope.mouseupT = function(event) {\n        event.target.style.backgroundImage = \"url('/png/Up_Arrow_Button.png')\";\n        scope.send({topic:\"Top\", payload: false})\n    }\n    scope.mousedownB = function(event) {\n        event.target.style.backgroundImage = \"url('/png/Dn_Arrow_Button1.png')\";\n        scope.send({topic:\"Bottom\", payload: true})\n    }\n    scope.mouseupB = function(event) {\n        event.target.style.backgroundImage = \"url('/png/Dn_Arrow_Button.png')\";\n        scope.send({topic:\"Bottom\", payload: false})\n    }\n})(scope);\n</script>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","className":"","x":550,"y":620,"wires":[["d1e9cc937a2a6269"]]},{"id":"d1e9cc937a2a6269","type":"debug","z":"5847b7aa62131d37","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":620,"wires":[]},{"id":"62350f50d4b09ff8","type":"ui_group","name":"Radio","tab":"554e77d51ad13f2d","order":1,"disp":false,"width":24,"collapse":false,"className":""},{"id":"554e77d51ad13f2d","type":"ui_tab","name":"PCR1000","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.