View Single Post
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#74
Hi,

I have made a fully functioning UI for my LED RGBW lighting strip (10 rows / 4 buttons per row).

I have used a MouseArea for each button, but this makes the code bulky.

I would like to know how to call each IR code from another page within my app, but I don't really know where to start.

Currently, I have this for each button on my first page;

Code:
    Row { id: row1; ........
        Rectangle { id: brightUp; width: 60; height: 60; radius: 30 .......
            MouseArea {
                anchors.fill: brightUp
                onClicked: {
                    var xmlhttp = new XMLHttpRequest()
                    xmlhttp.onreadystatechange = function() {
                        if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
                            console.log("Brightness UP")
                        }
                    }
                    xmlhttp.open("POST", "http://192.168.0.222/lightup")
                    xmlhttp.send()
                }
            }
I was thinking that a matrix of all 40 codes could be listed on the second page, but how would this look?, how do I call each code when a button is clicked on my first page?

Thanks,
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..

Last edited by Markkyboy; 2020-03-16 at 12:26.
 

The Following User Says Thank You to Markkyboy For This Useful Post: