Hey can you help me #163
Replies: 1 comment
-
@alexmathew11 var spacebutton = keyboard.createWidget(hmUI.widget.BUTTON, {
x: 10,
y: 85,
w: 40,
h: 30,
radius: 3,
normal_color: 0x000000,
press_color: 0x494949,
color: 0xfe8e40F,
text_size: 20,
text: "the",
click_func: function () {
var randomText = generateRandomText(); // call your function to generate random text
ustext2 = ustext2 + randomText + " "; // append the random text to ustext2
update();
}
});
function generateRandomText() {
// implement your logic to generate random text here
// for example, generate a random string of 5 characters
var randomChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var result = '';
for ( var i = 0; i < 5; i++ ) {
result += randomChars.charAt(Math.floor(Math.random() * randomChars.length));
}
return result;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey I just want a little help. So I have made this button so idea is that by clicking this button it will give random text which I want to put after (ustext2 + ) can you give me parameters or write the code for example for me.
thank you
Beta Was this translation helpful? Give feedback.
All reactions