KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Create a Macro toOpen a Form
PRODUCT: 4D | VERSION: 2003 | PLATFORM: Mac & Win
Published On: August 19, 2004

Compatible with 4D 2003

When creating forms, an integral step is testing them out. This involves creating a method to open your form. This may be something you do on a regular basis. If so, here is a macro to help speed up this task. This macro will enter three lines of text needed to open a form window. Simply copy the following XML text into your Macros.xml file located in the 4D Active Directory.

<macro name="OpenForm">
<text>
$winRef:=Open form window(EnterFormHere;8;Horizontally Centered ;Vertically Centered )
DIALOG(EnterFormHere)
CLOSE WINDOW($winRef)
</text>
</macro>

Be sure to place this xml between the <macros></macros> tags.

Now the next time you create a method, simply begin to type "OpenForm" and tab ahead and the macro will be generated for you. Replace the "EnterFormHere" with the appropriate table and form you'd like to test. You can also select this macro using the contextual menu and selecting Insert Macro -> OpenForm.

You should generate the following in the Method editor:

$winRef:=Open form window(EnterFormHere;8;Horizontally Centered ;Vertically Centered )
DIALOG(EnterFormHere)
CLOSE WINDOW($winRef)