diff --git a/instat/Model/Output/clsOutputLogger.vb b/instat/Model/Output/clsOutputLogger.vb
index 25e04fc2083..9905d4c7ea3 100644
--- a/instat/Model/Output/clsOutputLogger.vb
+++ b/instat/Model/Output/clsOutputLogger.vb
@@ -110,7 +110,7 @@ Public Class clsOutputLogger
'add the output with it's R script as another output element
outputElement.SetContent("", outputType, strOutput)
- '_outputElements.Add(outputElement)
+ _outputElements.Add(outputElement)
'raise event for output pages
RaiseEvent NewOutputAdded(outputElement, bDisplayOutputInExternalViewer)
diff --git a/instat/UserControl/ucrOutputPage.vb b/instat/UserControl/ucrOutputPage.vb
index 0d8972109b5..6188b0e197a 100644
--- a/instat/UserControl/ucrOutputPage.vb
+++ b/instat/UserControl/ucrOutputPage.vb
@@ -22,6 +22,10 @@ Imports RInsightF461
'''
Public Class ucrOutputPage
Private _checkBoxes As List(Of CheckBox)
+
+ ''' lastCheckedBox used to store a reference to a CheckBox control.
+ Private lastCheckedBox As CheckBox = Nothing
+
Private _bCanReOrder As Boolean
Private _bCanRename As Boolean
Private _bCanDelete As Boolean
@@ -115,6 +119,15 @@ Public Class ucrOutputPage
Next
End Sub
+ '''
+ ''' Selects all check boxes on the page
+ '''
+ Public Sub SelectAllCheckBoxes()
+ For Each checkbox In _checkBoxes
+ checkbox.Checked = True
+ Next
+ End Sub
+
'''
''' Clears all outputs on the page
'''
@@ -215,8 +228,6 @@ Public Class ucrOutputPage
End If
End Sub
-
-
Private Sub AddNewTextOutput(outputElement As clsOutputElement)
Dim panel As Panel = AddElementPanel(outputElement)
@@ -377,12 +388,11 @@ Public Class ucrOutputPage
}
panel.Controls.Add(checkBox)
_checkBoxes.Add(checkBox)
+ AddHandler checkBox.CheckedChanged, AddressOf CheckBox_CheckedChanged
AddHandler checkBox.Click, AddressOf checkButton_Click
AddHandler checkBox.MouseLeave, AddressOf panelContents_MouseLeave
End Sub
-
-
'''
''' Copies selected elements to clipboard
'''
@@ -478,7 +488,6 @@ Public Class ucrOutputPage
Next
End Sub
-
Private Sub SetRichTextBoxHeight(richTextBox As RichTextBox)
richTextBox.Height = (richTextBox.GetLineFromCharIndex(richTextBox.Text.Length) + 1) * (richTextBox.Font.Height + richTextBox.Margin.Vertical) + 5
End Sub
@@ -487,6 +496,41 @@ Public Class ucrOutputPage
pictureBox.Height = pictureBox.Width / (pictureBox.Image.Width / pictureBox.Image.Height)
End Sub
+ Private Sub CheckBox_CheckedChanged(sender As Object, e As EventArgs)
+ Dim currentBox As CheckBox = DirectCast(sender, CheckBox)
+
+ If lastCheckedBox IsNot Nothing AndAlso Control.ModifierKeys = Keys.Shift Then
+ Dim startIndex As Integer = _checkBoxes.IndexOf(lastCheckedBox)
+ Dim endIndex As Integer = _checkBoxes.IndexOf(currentBox)
+
+ ' Toggle check state for checkboxes between startIndex and endIndex
+ For i As Integer = Math.Min(startIndex, endIndex) To Math.Max(startIndex, endIndex)
+ _checkBoxes(i).Checked = currentBox.Checked
+ Next
+ End If
+
+ lastCheckedBox = currentBox
+ End Sub
+
+ Private Sub CheckBox_MouseDown(sender As Object, e As MouseEventArgs)
+ Dim currentBox As CheckBox = DirectCast(sender, CheckBox)
+
+ If e.Button = MouseButtons.Left AndAlso Control.ModifierKeys = Keys.Shift Then
+ ' Deselect all checkboxes between lastCheckedBox and currentBox
+ Dim startIndex As Integer = _checkBoxes.IndexOf(lastCheckedBox)
+ Dim endIndex As Integer = _checkBoxes.IndexOf(currentBox)
+
+ For i As Integer = Math.Min(startIndex, endIndex) + 1 To Math.Max(startIndex, endIndex) - 1
+ _checkBoxes(i).Checked = False
+ Next
+ ElseIf currentBox.Checked AndAlso Not Control.ModifierKeys = Keys.Shift Then
+ ' Deselect the current checkbox if already checked without Shift key
+ currentBox.Checked = False
+ End If
+
+ lastCheckedBox = currentBox
+ End Sub
+
Private Sub checkButton_Click(sender As Object, e As EventArgs)
RaiseEvent RefreshContextButtons()
End Sub
diff --git a/instat/UserControl/ucrOutputPages.resx b/instat/UserControl/ucrOutputPages.resx
index 65c47d1077b..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AIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
diff --git a/instat/UserControl/ucrOutputPages.vb b/instat/UserControl/ucrOutputPages.vb
index 3be43868659..167cae2b39c 100644
--- a/instat/UserControl/ucrOutputPages.vb
+++ b/instat/UserControl/ucrOutputPages.vb
@@ -25,6 +25,7 @@ Public Class ucrOutputPages
Private _outputLogger As clsOutputLogger
Private _selectedOutputPage As ucrOutputPage
Private _strSaveDirectory As String
+ Private checkBoxSelectAll As New CheckBox()
Public Sub New()
' This call is required by the designer.
@@ -38,6 +39,10 @@ Public Class ucrOutputPages
EnableDisableTopButtons()
End Sub
+ Private Sub ucrOutputPages_Load(sender As Object, e As EventArgs) Handles Me.Load
+ AddSelectAllCheckBoxToToolStripControl()
+ End Sub
+
'''
''' Holds options.
''' ToDo InstatOptions should be able to be accessed from anywhere
@@ -84,6 +89,7 @@ Public Class ucrOutputPages
Private Sub AddNewOutput(outputElement As clsOutputElement, bDisplayOutputInExternalViewer As Boolean)
ucrMainOutputPage.AddNewOutput(outputElement, bDisplayOutputInExternalViewer)
+ UpdateSelectAllCheckBoxText()
End Sub
Private Sub AddNewOutputToTab(outputElement As clsOutputElement, tabName As String)
@@ -153,6 +159,7 @@ Public Class ucrOutputPages
tbMoveUp.Enabled = False
End If
tbRename.Enabled = _selectedOutputPage.BCanRename
+ UpdateSelectAllCheckBoxText()
End Sub
Private Sub RefreshPage()
@@ -213,6 +220,7 @@ Public Class ucrOutputPages
_outputLogger.AddOutputToFilteredList(element.Clone, strTabName)
Next
_selectedOutputPage.ClearAllCheckBoxes()
+ UpdateSelectAllCheckBoxText()
End Sub
Private Sub tbCopy_Click(sender As Object, e As EventArgs) Handles tbCopy.Click
@@ -239,6 +247,7 @@ Public Class ucrOutputPages
Else
RefreshPage()
End If
+ UpdateSelectAllCheckBoxText()
End Sub
'''
@@ -303,4 +312,74 @@ Public Class ucrOutputPages
End If
Next
End Sub
+
+ Private Sub AddSelectAllCheckBoxToToolStripControl()
+ ' Create a ToolStripControlHost to host the CheckBox
+ Dim checkBoxHost As ToolStripControlHost = New ToolStripControlHost(checkBoxSelectAll)
+
+ ' Insert the CheckBox host at the beginning of tsButtons items
+ tsButtons.Items.Insert(0, checkBoxHost)
+
+ ' Create a ToolTip for the checkBoxSelectAll CheckBox
+ Dim ttcheckBoxSelectAll As New ToolTip
+ ttcheckBoxSelectAll.SetToolTip(checkBoxSelectAll, "Toggle selection for all elements")
+
+ ' Add a Click event handler to the checkBoxSelectAll CheckBox
+ AddHandler checkBoxSelectAll.Click, AddressOf checkBoxSelectAll_Click
+ End Sub
+
+ '''
+ ''' Updates the text and state of checkBoxSelectAll based on selected elements and output count.
+ '''
+ Private Sub UpdateSelectAllCheckBoxText()
+ ' Check if _outputLogger is initialized
+ If _outputLogger Is Nothing Then
+ Exit Sub ' Exit the sub if logger is not initialized
+ End If
+
+ ' Variable to hold the count of output elements
+ Dim iCountOutputElements As Integer = 0
+
+ ' Determine the count of output elements based on the selected tab
+ If SelectedTab() = "Main" Then
+ iCountOutputElements = _outputLogger.OutputElements.Count
+ Else
+ iCountOutputElements = _outputLogger.GetFilteredList(SelectedTab).Output.Count
+ End If
+
+ ' Enable or disable checkBoxSelectAll based on the count of output elements
+ checkBoxSelectAll.Enabled = iCountOutputElements > 0
+
+ ' Get the count of selected elements
+ Dim iSelectedElements = _selectedOutputPage.SelectedElements.Count
+
+ ' Determine the text and check state of checkBoxSelectAll based on selected and total elements
+ Select Case True
+ Case iSelectedElements > 0 AndAlso iCountOutputElements > iSelectedElements
+ ' Indeterminate state when some but not all elements are selected
+ checkBoxSelectAll.Text = $"{iSelectedElements} item(s)"
+ checkBoxSelectAll.CheckState = CheckState.Indeterminate
+ Case iSelectedElements > 0 AndAlso iCountOutputElements = iSelectedElements
+ ' All elements selected
+ checkBoxSelectAll.Text = "Deselect All"
+ checkBoxSelectAll.CheckState = CheckState.Checked
+ Case Else
+ ' No elements selected
+ checkBoxSelectAll.Text = "Select All"
+ checkBoxSelectAll.CheckState = CheckState.Unchecked
+ End Select
+ End Sub
+
+ Private Sub checkBoxSelectAll_Click(sender As Object, e As EventArgs)
+ ' Handle CheckBox checked changed event here
+ Dim checkBoxSelectAll As CheckBox = TryCast(sender, CheckBox)
+
+ If checkBoxSelectAll.Checked Then
+ _selectedOutputPage.SelectAllCheckBoxes()
+ Else
+ _selectedOutputPage.ClearAllCheckBoxes()
+ End If
+ EnableDisableTopButtons()
+ End Sub
+
End Class
\ No newline at end of file