Update CP7 display text continuously

I have a CP7 display that i have connected to a Fez Hydra. As long as i press the screen (a button), i need to increment a counter on the screen. To make the counter a bit slower, i have used a 200 millisecond sleep. My problem is the UI is not showing the updated value until released event. If i do it in a separate thread, i get the verify access problem.
The same works perfectly fine with a T35 display where i use Timer (tickevent handler).

a small program which shows this problem would help to get an answer.


  //Main function

            display_CP7.ScreenPressed += new Display_CP7.TouchEventHandler(display_CP7_ScreenPressed);
            display_CP7.screenReleased += new Display_CP7.TouchEventHandlerTouchReleased(display_CP7_screenReleased);


            //Inside Screen Pressed

            //Removing the touch event so that the timer event is not fired again. the touch event will be put back in Screen Released event
            display_CP7.ScreenPressed -= new Display_CP7.TouchEventHandler(display_CP7_ScreenPressed);


            stickyTimer = new GT.Timer(stickyDelay);
            stickyTimer.Tick += new GT.Timer.TickEventHandler(timerPowerPlus_Tick);
            stickyTimer.Start();

            //Inside timerPowerPlus_Tick
            powerLabel.TextContent = "0.5 W";


            //As long as the key is pressed, the tick will increment the powerLabel text.

            //Screen Released event code
            display_CP7.ScreenPressed += new Display_CP7.TouchEventHandler(display_CP7_ScreenPressed);
            is_Released = true;
            if (stickyTimer != null)
            {
                stickyTimer.Stop();
                stickyTimer = null;
            }

you have provided code snippets, not a complete program, so I am unable to completely understand what you are trying to do, or run the. program on my machine.

because your code is incomplete, I do not know GUI library you are using.

I suggest you simple program without the GUI and write the counter using debug.print.

I suggest you do not dynamically subscribe and unsubscribe to events.