KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Adding the "Shaking window to say No" effect
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: June 15, 2009
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

4D v11 SQL uses the "Shaking window to say No" effect in its User Identification dialog. If you enter an invalid User Name or Password and click Connect the window shakes to let you know you have made a mistake.

You can have the same effect in your custom login dialog by using the following code:


C_LONGINT($lLeft;$lTop;$lRight;$lBottom;$lCurrentProcess)
C_LONGINT($lLeft_Left;$lRight_Left;$lLeft_Right;$lRight_Right)

GET WINDOW RECT($lLeft;$lTop;$lRight;$lBottom)

$lLeft_Left:=$lLeft-10
$lRight_Left:=$lRight-10

$lLeft_Right:=$lLeft+10
$lRight_Right:=$lRight+10

$lCurrentProcess:=Current process

For ($i;1;5)
  SET WINDOW RECT($lLeft_Left;$lTop;$lRight_Left;$lBottom)
  DELAY PROCESS($lCurrentProcess;1)
  SET WINDOW RECT($lLeft_Right;$lTop;$lRight_Right;$lBottom)
  DELAY PROCESS($lCurrentProcess;1)
End for

SET WINDOW RECT($lLeft;$lTop;$lRight;$lBottom)


In this case we shake the window 5 times.

Commented by Jesse Pina on July 9, 2009 at 3:48 PM
This is a very user friendly way of letting the user know they have done something "wrong" or "incorrect". This method can also be combined with an alert message by having the "shaking" method run for the first X number of tries and then display a nomral alert message if the user still has not made an appropriate entry.