-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfrmPrompt.frm
135 lines (122 loc) · 3.93 KB
/
frmPrompt.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
VERSION 5.00
Begin VB.Form frmPrompt
BorderStyle = 4 'Fixed ToolWindow
Caption = "Title Here"
ClientHeight = 1680
ClientLeft = 45
ClientTop = 210
ClientWidth = 5790
ControlBox = 0 'False
Icon = "frmPrompt.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1680
ScaleWidth = 5790
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton cmdCancelAll
Caption = "Cancel All"
Height = 375
Left = 2880
TabIndex = 5
Top = 1230
Width = 1335
End
Begin VB.CommandButton cmdClear
Caption = "Clear"
Height = 315
Left = 4920
TabIndex = 4
Top = 705
Width = 735
End
Begin VB.TextBox Reply
Height = 285
Left = 105
TabIndex = 0
Top = 735
Width = 4725
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Height = 375
Left = 120
TabIndex = 3
Top = 1230
Width = 1335
End
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 375
Left = 4320
TabIndex = 1
Top = 1230
Width = 1335
End
Begin VB.Label Label
BackStyle = 0 'Transparent
Caption = "Question"
Height = 495
Left = 120
TabIndex = 2
Top = 120
Width = 5535
End
End
Attribute VB_Name = "frmPrompt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' CBM-Transfer - Copyright (C) 2007-2017 Steve J. Gray
' ====================================================
'
' frmPrompt - Prompt for Info
'
' Call 'Ask' with titlebar and msg test. ClearLast will clear edit box
' OK will exit with edit box as-is. Cancel will clear edit box
Private Sub Form_Load()
On Error Resume Next
End Sub
Private Sub Form_Activate()
DoEvents
Reply.SetFocus
End Sub
'---- Prompt User
Public Sub Ask(ByVal Title As String, ByVal Msg As String, ByVal CFlag As Integer, Optional ClearLast = True)
Response = ""
frmPrompt.Caption = Title 'Set TITLE BAR
Label.Caption = Msg
cmdCancel.Visible = False 'Hide CANCEL button
cmdCancelAll.Visible = False 'Hide CANCEL ALL button
If CFlag > 0 Then cmdCancel.Visible = True 'Enable CANCEL button
If CFlag = 2 Then cmdCancelAll.Visible = True 'Enable CANCEL ALL button
If (ClearLast) Then Reply.Text = "" 'Clear last response
Me.Show vbModal 'Show the Prompt
End Sub
'---- Process OK button
Private Sub cmdOK_Click()
Response = Trim(Reply.Text) 'Return the user's input
Me.Hide
End Sub
'---- Process CANCEL button
Private Sub cmdCancel_Click()
Reply.Text = ""
Response = "" 'Return NULL
Me.Hide
End Sub
'---- Process CANCEL ALL button
Private Sub cmdCancelAll_Click()
Reply.Text = ""
Response = "***" 'Special string to indicate cancelling batch operation
Me.Hide
End Sub
'---- Process CLEAR button
Private Sub cmdClear_Click()
Reply.Text = "" 'Clear current input
End Sub
'---- Handle Keypresses to Input box
Private Sub Reply_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = 13) Then KeyCode = 0: cmdOK_Click 'Enable Enter Key
End Sub