How to swap spinner selection between two spinners

i have made a currency converter in which two spinners are involved
need is when i press swap icon selection have to interchangeblocks blocks

when i did like this only the spinner 2 selection is interchanged keeping spinner 1 value same as it was

You need to save Spinner1.Selection to a variable, then swap values

set x to Spinner1.Selection // value of Spinner1.Selection saved to x
set Spinner1.Selection to Spinner2.Selection // copy (2) to (1)
set Spinner2.Selection to x // set (2) to what (1) was.

x is a variable holding integer (not Spinner)

2 Likes

blockdsdsds

you mean like this but it’s not working

Spinner1 and Spinner2 are composed of which type elements? texts, icons? something else?

text like USD, INR, etc.,

Hello,
You set the variable x to spinner 1 value but you didn’t use it.

just tell me how thanks in advance

I can’t test it now, but in theory it should work perfectly.
spinner1and2

2 Likes

These blocks do the following:

  1. Save Selection of Spinner1 to x.
  2. Set selected text of Spiiner1 to selected text of Spinner2 (copy (2) to (1)).
  3. Set selected text of Spinner2 to previous selected text of Spinner1 (beeing saved to x).

PS.
I use when Button1.Click
You use an event when Label1.Click
Note that you will nothing see unless you have set
set Label1.Clickable to true

blocksSpinner

3 Likes