KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Open Window Macro
PRODUCT: 4D | VERSION: 2003 | PLATFORM: Mac & Win
Published On: June 3, 2004
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Here is a simple but useful macro you can add to your Macro.xml file found in the Active 4D folders on both Windows and Mac. The macro generates code that can be used to open a plain centered dialog form window. Simply cut and paste the following macro fragment in between the <macros> ... </macros> tags.

<macro name="OpenDialog">
 <text>
  C_LONGINT($windowRef)
  $windowRef:=Open form window(<selection/>;Plain window;Horizontally centered;Vertically centered)
  DIALOG(<selection/>)
  CLOSE WINDOW($windowRef)
 </text>
</macro>

To test it out, write and highlight the following code in the method editor:

[Table 1];"Form1"

Call the macro OpenDialog and the macro will automatically write out the code necessary to open the dialog window.

After the macro call, you'll have the following:

C_LONGINT($windowRef)
$windowRef:=Open form window([Table 1];"Form1";Plain window;Horizontally Centered;Vertically Centered)
DIALOG([Table 1];"Form1")
CLOSE WINDOW($windowRef)