PA_NewWindow

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_NewWindow (wRect; wLevel; wKind; wTitle; closeBox) PA_WindowRef

ParameterTypeDescription
wRectPA_RectGlobal coordinates of window
wLevelPA_WindowLevelWindow level
wKindshortWindow kind
wTitlechar *Window title
closeBoxchar1 = Has closebox
Function resultPA_WindowRefReference to the created window

Description

The routine PA_NewWindow creates a new window.

Pass the global coordinates of the window in wRect.

Pass the level of the window in wLevel. It is one of the following enum:

typedef enum
{
   eWL_Window      = 1,
   eWL_Palette     = 2,
   eWL_Dialog      = 5,
   eWL_OnEvent     = 6,
   eWL_Toolbar     = 7,
   eWL_Combo       = 8,
   eWL_Tip         = 9,
   eWL_SuperDialog = 10
} PA_WindowLevel;

The level of a window tells 4D how to draw the window in relation to other windows: a tip is always in front, a combo is behind a tip, a dialog is over a palette, a standard window is behind all of this.

Pass the kind of the window in wKind. Use the usual values that can be passed to the Open window 4th Dimension function: 0 = "plain no zoom box", 1 = "Modal dialog box", 2 = "Plain dialog box", etc.

Pass the title of the window in wTitle (Pascal or C string, depending on default settings or previous calls to PA_UsePStrings or PA_UseCStrings).

Pass at least 1 in closeBox to add a closebox to your window. Note that this parameter is ignored for certain kind of windows.

This routine is usually used in the code of an external process, but it can be called elsewhere (ie: drawing a thermometer window).

It is important that Windows programmers use this routine to create their windows as it is the only way for 4th Dimension to recognize the window as one of its windows. On the other hand, using MacOS API routines such as NewCWindow is sufficient for adding the window to the 4th Dimension WindowList, but this can be done only when compiling for MacOS and for Windows using Altura Mac32Win.

Thus, for multi-platform purposes, plug-in developers should use PA_NewWindow to create a window.

To close a window created with PA_NewWindow, use PA_CloseWindow or the 4th Dimension command CLOSE WINDOW. Please note that PA_CloseWindow cannot close plug-in external windows.

NOTE

Windows programmers can add a winProc to the newly created window : get its corresponding HWND (PA_GetHWND) and call SetWindowLong with the adress of the winProc.

Example

Some wrappers to PA_NewWindow.

   #define kNO_CLOSEBOX   ((char) 0)
   #define kCLOSEBOX      ((char)1)
   PA_WindowRef   CreateDocumentWindow(PA_Rect r, char *title)
   {
      return PA_NewWindow(r, eWL_Window, 0, title, kCLOSEBOX);
   }

   PA_WindowRef   CreateDialogtWindow(PA_Rect r, char *title)
   {
      return PA_NewWindow(r, eWL_Dialog, 5, title, kNO_CLOSEBOX);
   }

   PA_WindowRef   CreatePalette(PA_Rect r, char *title)
   {
      return PA_NewWindow(r, eWL_Palette, 722, title, kNO_CLOSEBOX);
   }

See Also

PA_CloseWindow.

Error Handling

None.


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next