This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Custom value 1 bit
#1
Hi there,
I would like to customize the visu of 1 bit object (0 = Auto ; 1 = manual). But in Touch Visualisation (smartphone) I can choose visualisation in checkbox or toggle.

I would like show and manage manual or auto written.

What do you suggest please?

Thanks.
Reply
#2
There's no direct way of doing this but it can be done with some custom JS and CSS.

This example uses custom additional class and 32/1/1 group address, change in both JS and CSS as needed.

JS:
Code:
$(function() {
  if (typeof grp === 'object') {
    grp.listen('32/1/1', function(obj) {
      setTimeout(function() {
        $('.custom .btn').text(obj.value ? 'Manual' : 'Auto');
      }, 1);
    });
  }
});

CSS:
Code:
.touch .custom .btn {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
Reply
#3
Thank you Daniel,
only to be sure.

The modify about JS is done in additional classes field of the icon of 32/1/1.

Instead modify of CSS is done is Custom CSS of vis.graphic tab. Is it?

If so it does not work.

Thanks.
Reply
#4
JS is under Scripting ->Tools -> Custom Java Script

PS
Code:
Admin ~=Daniel.
------------------------------
Ctrl+F5
Reply
#5
            Hi Daniel,
please find enclosed what I did.

What's wrong?

Thanks.

Attached Files Thumbnail(s)
       
Reply
#6
To see any result you have to open end visualization not editor and Add additional class 'custom' to the button on visu
------------------------------
Ctrl+F5
Reply
#7
(26.07.2019, 14:05)Daniel. Wrote: To see any result you have to open end visualization not editor.

I did it. Find enclosed the result.

Thanks.

Attached Files Thumbnail(s)
   
Reply
#8
Additional class 'custom' is missing
------------------------------
Ctrl+F5
Reply
#9
(26.07.2019, 14:11)Daniel. Wrote: Additional class 'custom' is missing

Ok, I have to add there the same instruction I did in JS script.


$(function() {
  if (typeof grp === 'object') {
    grp.listen('32/1/1', function(obj) {
      setTimeout(function() {
        $('.custom .btn').text(obj.value ? 'Manual' : 'Auto');
      }, 1);
    });
  }
});

I did it without success.

Thanks.


Reply
#10
In the Visu editor

Attached Files Thumbnail(s)
   
------------------------------
Ctrl+F5
Reply
#11
Note that this will only work in Touch visualization, not in the editor.
Reply
#12
ooooooooooooook!! Thanks.

Everything is clear now. Custom is the name given to the btn.

Now I have created different name so I can link the any object I want.

I thank you very much for your support.

Regards.
Reply
#13
No problem, keep in mind that you need different additional class for each group addresses if you have several buttons like this.
Reply


Forum Jump: