2017년 6월 8일 목요일

Multiple actions variable by text box?


So I'm tweaking an app that I've built and one of my friends pointed out that one of the buttons could do with having a variable box next to it so instead of pressing the button 20 times I could just type 20 and it would have the same effect, does anyone have any idea how to do this, I've got it all laid out on screen but can't seem to get my head around the blocks?

--
Use a TextBox.    In the Designer screen, where it indicates Properties,  find the NumbersOnly check box.   Check it, the text box will only accept numbers.

Then,   if you want the 20 in a Label ;    set Label1.text to TextBox1.Text     within the Button event handler.

Try some blocks, show a png or jpg screen capture image if you run into difficulty and ask again.

Does that work or do you want to do something different?

--
Hi There, I'll try and explain a bit more as I'm not sure I was very clear on my last post, 

My app looks something like this:

"Top Button

Bottom Button          Text Box"

The idea is that when I press the top button it sends a message but if I enter a number between 2 and 20 into the text box and press the bottom button it would complete the top buttons action multiplied by the number in the text box. The text box is set to numbers only

I also would like to restrict the number you can put into the text box to prevent people from crashing my app and there phones etc...

I cant help feeling I've almost got it but for the life of me I'm missing something!

--
The forum members can not help you more unless you share an image of your blocks so far.

Restrict numbers.?.. use a if else block      with conditionals where if number < 2 or number > 20    provide an error message else proceed.

This code is possibly similar to what you want to do.  Yes, it not exactly what you want but it should provide you a hint about what you should do.

Multiplication Table
The ∖n character in a label makes a line change.     You probably will not need that.   

If you want to do something different and want specific advice, the forum members need to see a screen capture of what you have so far .
Try some blocks and ask again.

--
Nick... Create a procedure to do what Button1 does, but with an input value.  Then call that procedure from button1 with "1" as the input.

In button2.click, call the same procedure with the value of the text box as the input.  In that prodecure, you can check to see if the text box value is greater than 20...

--
Ok I'm still struggling a little here but have got a screen shot of what I have so far,  Enis from what you're saying it seems to make the most sense but I'm not sure how to do that? (i.e. give an input value for the procedure)

anyway, here's what I have so far, hope you can help




--
Ok I tried what you said Enis but think I may have gotten something wrong (as it still only sends 1 message)

Here's what I've done 



--
Nick... post a screenshot please of the entire function so I can see what you're joining.

--
Actually, that's not necessary... Yes, it only sends one... In order to send multiples, you'd have to have a loop in the proc that goes x times (whatever's in the text box).  Use a for each, with the count being the x of the proc...

--
The Joins are just 2 lines of text 1 is the random message and the other the footer for the message, they could in fact be put into one box, I was just being lazy and didn't want to type the same footer over and over again so did the join to save time

--
yeah that's where I'm struggling, the message is random each time, so In theory I would like someone to be able te enter the number 4 in the text box and the proc to loop 4 times with hopefully 4 different messages going out to the same recipient. I just cant quite work it out, 

--
The message should still be random... In the beginning of the proc, start with the for each block.  Then, inside of that, do all of your other stuff... It should be random.  BUT, if you're allowing 20 and you have 16 entries, there will be replications.  That's also possible if you're trying to get 20 from 40, or even 100.  IT would take an awful lot of random thoughts to almost guarantee generating a different one for 20 tries.

--
I managed to get it to work after a couple of continuous loops and a couple of false starts so thank you very much for your help, now any idea on how I can get people to login with facebook? I have a feeling this one is going to be a lot more difficult! 

--

댓글 없음:

댓글 쓰기