VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} OpenedForm BorderStyle = 3 'Fixed Dialog Caption = "OpenedForm" ClientHeight = 5910 ClientLeft = 45 ClientTop = 435 ClientWidth = 7725 ControlBox = 0 'False MaxButton = 0 'False MinButton = 0 'False OleObjectBlob = "OpenedForm.dsx":0000 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner End Attribute VB_Name = "OpenedForm" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private m_Listbox As ListBoxCopy Private m_ConfirmDisplay As Boolean Private m_port As String Private m_IsError As Boolean Private Sub cmdClose_Click() On Error GoTo Error_Block Dim t As Tracker: Set t = GStackTrace.Enter(TypeName(Me), "cmdClose_Click") Unload Me Exit Sub Error_Block: t.Report End Sub Public Sub DisplayResult(Title As String, FilePath As String, Result As Long, _ InfoArr() As String, ErrorArr() As String) Dim t As Tracker: Set t = GStackTrace.Enter(TypeName(Me), "DisplayResult") Dim p4 As P4COM.p4 Set p4 = NewP4 Me.Caption = Title If Len(FilePath) <> 0 Then FileName = FilePath Else FileName.Visible = False FilenameLabel.Visible = False End If ResultBox.Clear m_IsError = False If Result <> 0 Then m_IsError = True AddToListBox Me, ResultBox, "*** Error ***" ' Assume that other errors will be documented by return value If IsEmptyArray(InfoArr) And IsEmptyArray(ErrorArr) Then AddToListBox Me, ResultBox, "Error communicating with Perforce server (" & p4.port & ")" AddToListBox Me, ResultBox, "Please check that the Perforce server is" AddToListBox Me, ResultBox, "running, and check your environment settings" AddToListBox Me, ResultBox, "(P4PORT, P4CLIENT, P4CONFIG, etc.)." End If End If DisplayArray InfoArr, Me, ResultBox DisplayArray ErrorArr, Me, ResultBox Screen.MousePointer = vbDefault SetParent2 Me, g_p4interface.App.Caption Me.Show vbModal Unload Me End Sub Private Sub InitForm() Dim t As Tracker: Set t = GStackTrace.Enter(TypeName(Me), "InitForm") Set m_Listbox = New ListBoxCopy m_Listbox.Initialize Me, ResultBox m_ConfirmDisplay = False End Sub Private Function OnlyOneSelected(ind As Integer) As Boolean ' Checks how many rows selected and returns the one required. Dim t As Tracker: Set t = GStackTrace.Enter(TypeName(Me), "OnlyOneSelected") Dim i As Integer Dim bFound As Boolean bFound = False ind = 0 i = 0 While i < ResultBox.ListCount If ResultBox.Selected(i) Then ind = i If bFound Then OnlyOneSelected = False Exit Function Else bFound = True End If End If i = i + 1 Wend OnlyOneSelected = bFound End Function Private Sub ResultBox_Change() ResultBox_Click End Sub Private Sub ResultBox_Click() On Error GoTo Error_Block Dim t As Tracker: Set t = GStackTrace.Enter(TypeName(Me), "ResultBox_Click") Dim ind As Integer If OnlyOneSelected(ind) And Not m_IsError Then cmdOpenFile.Enabled = True cmdOpenFile.Default = True Else cmdOpenFile.Enabled = False cmdOpenFile.Default = False cmdClose.Default = True End If Exit Sub Error_Block: t.Report End Sub Private Sub ResultBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean) On Error GoTo Error_Block Dim t As Tracker: Set t = GStackTrace.Enter(TypeName(Me), "ResultBox_DblClick") Dim ind As Integer If OnlyOneSelected(ind) And Not m_IsError Then cmdOpenFile_Click End If Exit Sub Error_Block: t.Report End Sub Private Sub cmdOpenFile_Click() On Error GoTo Error_Block Dim t As Tracker: Set t = GStackTrace.Enter(TypeName(Me), "cmdOpenFile_Click") Dim ind As Integer Dim i As Integer Dim SelectedFile As String If OnlyOneSelected(ind) Then SelectedFile = ResultBox.list(ind) i = InStr(1, SelectedFile, "#") If i > 0 Then SelectedFile = VBA.Left$(SelectedFile, i - 1) Me.Hide g_p4interface.ShellExecute SelectedFile End If End If Exit Sub Error_Block: t.Report End Sub Private Sub UserForm_Initialize() ' Allow right click menu for copying to clipboard On Error GoTo Error_Block Dim t As Tracker: Set t = GStackTrace.Enter(TypeName(Me), "UserForm_Initialize") InitForm Exit Sub Error_Block: t.Report End Sub
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 10843 | Robert Cowham |
Initial version of P4OFC source code. See README.txt (and LICENSE.txt and doc\P4OFC-Design.docx) |