toggle button on ft800 touch screen

I am try to write a program when press touch button , number 20 will display on the screen and keep on the screen .
when i press the button again the number will change to 50
i want this button work as toggle button
my code doesn’t work

#include <EEPROM.h>
#include <SPI.h>
#include <Wire.h>
#include <FT_ADAM_4DLCD_FT843.h>
sTagXY sTagxy;
int old=0;
int prev=0;
int tagval;
FT800IMPL_SPI FTImpl(10,5,3);
void setup()
{

FTImpl.Init(FT_DISPLAY_WQVGA_480x272);
FTImpl.SetDisplayEnablePin(FT_DISPENABLE_PIN);
FTImpl.SetAudioEnablePin(FT_AUDIOENABLE_PIN);
FTImpl.DisplayOn();
FTImpl.AudioOn();
FTImpl.Cmd_Calibrate(0);
FTImpl.DLStart();
FTImpl.Finish();
FTImpl.DLStart();
FTImpl.DLEnd();
FTImpl.Finish();
}

void loop()
{
FTImpl.DLStart();

FTImpl.Tag(12);
FTImpl.Cmd_Button(172, 134, 120, 36, 27, 0, “Button”);
FTImpl.GetTagXY(sTagxy);
tagval = sTagxy.tag;
old=tagval;
if(12 == old && prev==0)
{
FTImpl.Cmd_Number(130, 55, 28, 0, 20);
delay(100);
prev=1+prev;
}
if(12 == old && prev==1 )
{
FTImpl.Cmd_Number(130, 55, 28, 0, 50);
delay(100);
prev= 1-prev;
}

FTImpl.DLEnd();
FTImpl.Finish();
}

The code you posted does something. We can't see what it does. You have to tell us.

The magic numbers in the code do not help us understand what is going on.

You only have one button, with a tag of 12. It seems unnecessary to compare the tag of the button that was pressed, if indeed one was pressed (I can't see how you are determining that), to the only button's tag, to determine which of the one buttons was pressed.

the idea from my code , I want to make the button in touch screen works as toggle button . i think this video illustrate my idea https://www.youtube.com/watch?v=6ddH4JsXfK0 but the different i want one button to use

I use the tag to know if there is any touch for the button