Navigation:  ThinBASIC Modules > UI (User Interface) > DIALOGSs >

DIALOG NEW or Dialog_New

Previous pageReturn to chapter overviewNext page

 

Description

 

Creates a new dialog (window).

 

Syntax

 

[hwnd =] DIALOG NEW [{PIXELS, | UNITS},] [Name sDialogName,] hwParent, Title, xPos, yPos, Width, Height [, [Style] [, [ExtendedStyle] ] ] [TO hwnd]

 

Alternative Syntax

 

hwnd = Dialog_New([{PIXELS, | UNITS},] hwParent, Title, xPos, yPos, Width, Height [, [Style] [, [ExtendedStyle]]] )

 

Returns

 

Handle to the new created window.

Zero means error.

 

Parameters

 

Name

Type

Optional

Meaning

PIXELS | UNITS


Yes

If the PIXELS is specified, all size and position are specified in pixels.

If UNITS is specified, all size and position are specified in units.

UNITS is the default one if this parameter is not specified.

sDialogName

String

Yes

Optional DialogName string.
If specified, DialogName can be used to create callback functions name that will be automatically executed by thinBasic User Interface engine when specific Windows events will occur

hwParent

Number

No

Handle of the parent window

Title

String

No

String expression used to set window title

xPos

Number

No

Upper x position

yPos

Number

No

Upper y position

Width

Number

No

Width of the new window

Height

Number

No

Height of the new window

Style

Number

Yes

An optional bitmask describing how the dialog should be displayed. See Dialog Style equates.

ExtendedStyle

Number

Yes

An optional extended style bitmask describing how the dialog should be displayed. See Dialog ExtendedStyle equates.

hwnd

Variable

No

A numeric single variable name that will receive the handle of the new window.

 

Remarks

 

All size and position parameters passed to functions working with dialogs and controls will be sensible to PIXELS | UNITS option specified when the dialog is creates.

 

Restrictions

 

See also

 

Examples

 

USES "UI"

 

'---Define a button ID

%ButtonClose = 1001

 

Dim hDlg As DWORD

 

DIALOG New 0, "APPTITLE",-1,-1, 330, 203, _

                                   %WS_POPUP         Or _

                                   %WS_VISIBLE       Or _

                                   %WS_CLIPCHILDREN  Or _

                                   %WS_CAPTION       Or _

                                   %WS_SYSMENU       Or _

                                   %WS_MINIMIZEBOX,     _

                                   0 To hDlg

 

CONTROL ADD BUTTON, hDlg, %ButtonClose, "Click to kill", 90, 50, 150, 100

 

DIALOG SHOW MODAL hDlg Call cbDialog

 

'------------------------------------------------

' Callback function used to handle dialog events

'------------------------------------------------

CALLBACK Function cbDialog() As Long

 

  Select Case CBMSG

    Case %WM_Command

      If CBWPARAM = %ButtonClose Then DIALOG End CBHNDL

 

    Case %WM_DESTROY

      MSGBOX 0, "Window is to be destroyed."

      

  End Select 

 

End Function