Support Forum

Ask questions and get help from MobileTogether experts.
MobileTogether Product Information
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
am2002  
#1 Posted : Monday, May 18, 2020 11:25:22 AM(UTC)
am2002

Rank: Newbie

Groups: Registered
Joined: 5/18/2020(UTC)
Posts: 2

I would like to realize the next application - Each time the button is pressed, the canvas\background is painted with various colors generated randomly. Please, help me. I not found nothing in Designer for it
MIP  
#2 Posted : Monday, May 18, 2020 1:22:09 PM(UTC)
MIP

Rank: Member

Groups: Registered
Joined: 7/22/2019(UTC)
Posts: 22
Austria
Location: Vienna

Was thanked: 4 time(s) in 4 post(s)
Hi,

just one way how you can create a random color via xpath on a button press. is to create a random number from 0 to 0xffffff, then add leading 0 until you reach 6 digits, prefix the whole thing with #

Code:

'#'|| pad-string-left(
		integer-to-hex-string( xs:integer ( fn:random-number-generator(fn:current-dateTime())?number * hex-string-to-integer('ffffff') ) ),
  		6, '0' )
am2002  
#3 Posted : Monday, May 18, 2020 2:03:45 PM(UTC)
am2002

Rank: Newbie

Groups: Registered
Joined: 5/18/2020(UTC)
Posts: 2

Hi,
Thanks for the hint how to get a random color through its recording in RGB, but I don’t understand how to set the background color by clicking. This is where help is needed :)
MIP  
#4 Posted : Monday, May 18, 2020 2:42:45 PM(UTC)
MIP

Rank: Member

Groups: Registered
Joined: 7/22/2019(UTC)
Posts: 22
Austria
Location: Vienna

Was thanked: 4 time(s) in 4 post(s)
just create an attribute, element, variable,... for your bk color.
Initialize with whatever color you want "#000000" for black for example.
Assign this element to the tables background color.
On button click:
update node -> your bk color element,...
with result of -> the random color code
Users browsing this topic
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.