Hi,
We are using a Dialog Box template to display the list of attachments linked to a record. However, when users invoke this dialog box, the CPU usage shoots up to more than 80% and stays there till the dialog box is closed. Appreciate any help! Thanks in advance
Following is the sample code used
Do
Begin Dialog CurrentAttachmentTemplate 200,150,175,120,"Current Attachments...",.CurrentAttachmentProc
ListBox 8,8,120,94,files$,.Files
PushButton 132,8,40,14,"Open",.View
PushButton 132,26,40,14,"Download",.Download
PushButton 132,44,40,14,"Detail",.Detail
PushButton 132,62,40,14,"Delete",.Delete
PushButton 132,80,40,14,"Close",.Cancel
PushButton 40,102,100,14,"Create a New Attachment",.New
End Dialog
Dim CurrentAttachments As CurrentAttachmentTemplate
r% = Dialog(CurrentAttachments,6,0)
:
:
Loop While (Not ((r% = 4 And del% = 1) Or r% = 5 Or (r% = 6 And rn% = 2)))
:
:
Exit Sub
Function CurrentAttachmentProc(ControlName$, Action%, SuppValue%)
On Error Goto currentattach_error_handler
If Action% = 1 Then
If iGroup.Mode = MODE_UPDATE Then
DlgEnable "Delete", False
DlgEnable "New", False
End If
If PopulateCurrentAttachment Then
count = UBound(files, 2)
ReDim fileNames(count) As String
For j = 0 To count
fileNames(j) = files(1, j)
Next j
DlgListBoxArray "Files", fileNames
DlgValue "Files", selectedFile
Else
DlgEnable "View", False
DlgEnable "Download", False
DlgEnable "Detail", False
DlgEnable "Delete", False
End If
ElseIf Action% = 2 And ControlName$ = "View" Then
:
:
Exit Sub
We are using a Dialog Box template to display the list of attachments linked to a record. However, when users invoke this dialog box, the CPU usage shoots up to more than 80% and stays there till the dialog box is closed. Appreciate any help! Thanks in advance
Following is the sample code used
Do
Begin Dialog CurrentAttachmentTemplate 200,150,175,120,"Current Attachments...",.CurrentAttachmentProc
ListBox 8,8,120,94,files$,.Files
PushButton 132,8,40,14,"Open",.View
PushButton 132,26,40,14,"Download",.Download
PushButton 132,44,40,14,"Detail",.Detail
PushButton 132,62,40,14,"Delete",.Delete
PushButton 132,80,40,14,"Close",.Cancel
PushButton 40,102,100,14,"Create a New Attachment",.New
End Dialog
Dim CurrentAttachments As CurrentAttachmentTemplate
r% = Dialog(CurrentAttachments,6,0)
:
:
Loop While (Not ((r% = 4 And del% = 1) Or r% = 5 Or (r% = 6 And rn% = 2)))
:
:
Exit Sub
Function CurrentAttachmentProc(ControlName$, Action%, SuppValue%)
On Error Goto currentattach_error_handler
If Action% = 1 Then
If iGroup.Mode = MODE_UPDATE Then
DlgEnable "Delete", False
DlgEnable "New", False
End If
If PopulateCurrentAttachment Then
count = UBound(files, 2)
ReDim fileNames(count) As String
For j = 0 To count
fileNames(j) = files(1, j)
Next j
DlgListBoxArray "Files", fileNames
DlgValue "Files", selectedFile
Else
DlgEnable "View", False
DlgEnable "Download", False
DlgEnable "Detail", False
DlgEnable "Delete", False
End If
ElseIf Action% = 2 And ControlName$ = "View" Then
:
:
Exit Sub