KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Making a button title blink
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: December 20, 2002

Compatibility: Version 6.7.x and 6.8.x

One of the many ways to draw the attention of the user to a specific object is to animate it. It is one technique that will give the user the sense of urgency and let them know that the object requires his or her attention. Most often, the animation is usually done to the button object.

Here is an easy way to animate a button by making the title of the button blink continuously.

In the form method, you can place the following code to initialize the required variable and to create a blinking effect on a button.

Case of
 : (Form event=On Load )
 C_BOOLEAN(<>notitled)
 <>notitled:=False
 : (Form event=On Timer )
 If (<>notitled)
  BUTTON TEXT(targetButton;"Click me")
  <>notitled:=False
 Else
  BUTTON TEXT(targetButton;"")
  <>notitled:=True
 End if
End case

In this example, the name of the button variable is targetButton. The title will be on and off between “Click me” and “” (empty string). You may need to change the name of the button variable to match one that you are using in your project.

To trigger this effect, execute the following code:

<>notitled:=True
SET TIMER(20)

To stop the button title from blinking, execute the following code:

SET TIMER(0)