Douglas Farias Expert Licensed User Longtime User Jun 18, 2014 #1 how can i put a label random position on my screen for exemple when start the app show 10% top 10% left or 20% top etc random its possible?
how can i put a label random position on my screen for exemple when start the app show 10% top 10% left or 20% top etc random its possible?
NJDude Expert Licensed User Longtime User Jun 18, 2014 #2 Yes it is possible, have you tried? Upvote 0
Douglas Farias Expert Licensed User Longtime User Jun 18, 2014 #3 with Label1.Left = caca&"%y" xD CACA is a random rnd(0,99) result and this dont work Rnd(0,99)%y Upvote 0
NJDude Expert Licensed User Longtime User Jun 18, 2014 #4 You cannot do VarName & "%" but you are on the right path. Upvote 0
Douglas Farias Expert Licensed User Longtime User Jun 18, 2014 #5 if help someone B4X: Dim lado,alto As Int lado = GetDeviceLayoutValues.Width alto = GetDeviceLayoutValues.Height r1 = Rnd(0,lado) r2 = Rnd(0,alto) Label1.Left = r1 Label1.top = r2 Upvote 0
if help someone B4X: Dim lado,alto As Int lado = GetDeviceLayoutValues.Width alto = GetDeviceLayoutValues.Height r1 = Rnd(0,lado) r2 = Rnd(0,alto) Label1.Left = r1 Label1.top = r2
stevel05 Expert Licensed User Longtime User Jun 18, 2014 #6 Just limit the width and height so the label doesn't disappear off the screen: B4X: r1 = Rnd(0,lado - Label1.Width) r2 = Rnd(0,alto - Label1.Height) Upvote 0
Just limit the width and height so the label doesn't disappear off the screen: B4X: r1 = Rnd(0,lado - Label1.Width) r2 = Rnd(0,alto - Label1.Height)
Douglas Farias Expert Licensed User Longtime User Jun 18, 2014 #7 xD when I went to post you posted first thx man i see this problem because i have my label out of screen Upvote 0
xD when I went to post you posted first thx man i see this problem because i have my label out of screen
NJDude Expert Licensed User Longtime User Jun 18, 2014 #8 Or you could limit the area too, check the attached sample. Attachments SillySample.zip 9.6 KB · Views: 172 Upvote 0
NJDude Expert Licensed User Longtime User Jun 18, 2014 #9 stevel05 said: Just limit the width and height so the label doesn't disappear off the screen: B4X: r1 = Rnd(0,lado - Label1.Width) r2 = Rnd(0,alto - Label1.Height) Click to expand... The label will disappear or look incomplete in case the number is zero. Upvote 0
stevel05 said: Just limit the width and height so the label doesn't disappear off the screen: B4X: r1 = Rnd(0,lado - Label1.Width) r2 = Rnd(0,alto - Label1.Height) Click to expand... The label will disappear or look incomplete in case the number is zero.
stevel05 Expert Licensed User Longtime User Jun 18, 2014 #10 The label will disappear or look incomplete in case the number is zero. Click to expand... 0,0 is top left, you should be able to see all of the label. It may not be where you want it though. Limiting to borders is a good idea. Upvote 0
The label will disappear or look incomplete in case the number is zero. Click to expand... 0,0 is top left, you should be able to see all of the label. It may not be where you want it though. Limiting to borders is a good idea.