KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Changing the default button on a CONFIRM
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: March 24, 2000

Often, 4D developers use code in their projects similar to the following:

CONFIRM("Do you really want to save a duplicate record?";"OK";"Cancel")
IF (OK=1)
 ACCEPT
ELSE
 REJECT
END IF



This is logical, consistent and works fine. However, you may find users creating more duplicate records than you intended since the default button is OK to save the duplicate. What if you intended to discourage users from creating duplicate records? In that case it would be preferable to make Cancel the default button, for clarity let's also change OK/Cancel into "Yes" and "No".

CONFIRM("Do you really want to save a duplicate record?";"No";"Yes")
IF (OK=1)
 REJECT
ELSE
 ACCEPT
END IF