Syntax 

DlgSetPicture DlgItem, FileName, Type


Group 

Dialog Function 


Description 

Instruction: Set the file name for DlgItem.

This instruction/function must be called directly or indirectly from a dialogfunc.


Parameters

Description

DlgItem 

If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc. If this is a string value then it is the dialog item's field name.

FileName 

Set the file name of DlgItem to this string value.

Type 

This numeric value indicates the type of bitmap used. See below.


Type

Effect

0

FileName is the name of the bitmap file. If the file does not exist then "(missing picture)" is displayed.

3

The clipboard's bitmap is displayed. If the clipboard does not contain a bitmap then "(missing picture)" is displayed.

16

Same a 0, but instead of displaying "(missing picture)" a run-time error occurs.

19

Same a 3, but instead of displaying "(missing picture)" a run-time error occurs.


Example

Sub Main

    Begin Dialog UserDialog 200,120,.DialogFunc

        Picture 10,10,180,75,"",0,.Picture

        OKButton 30,90,60,20

        PushButton 110,90,60,20,"&View"

    End Dialog

    Dim dlg As UserDialog

    Debug.Print Dialog(dlg)

End Sub

 

Function DialogFunc(DlgItem$, Action%, SuppValue?) As Boolean

    Debug.Print "Action="; Action%

    Select Case Action%

    Case 1 ' Dialog box initialization

        Beep

    Case 2 ' Value changing or button pressed

        Select Case DlgItem$

        Case "View"

            FileName = GetFilePath("Bitmap","BMP")

            DlgSetPicture "Picture",FileName,0

            DialogFunc = True 'do not exit the dialog

        End Select

    End Select

End Function