Skip to content

Commit bfa14e6

Browse files
committed
deleting several items at once
1 parent 900ba00 commit bfa14e6

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

Forms/FMain.frm

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Begin VB.Form FMain
6666
EndProperty
6767
Height = 2985
6868
Left = 0
69-
MultiSelect = 1 '1 -Einfach
69+
MultiSelect = 2 'Erweitert
7070
OLEDragMode = 1 'Automatisch
7171
OLEDropMode = 1 'Manuell
7272
TabIndex = 0
@@ -127,7 +127,7 @@ Begin VB.Form FMain
127127
Caption = "Add To Trip"
128128
End
129129
Begin VB.Menu mnuGeoPosDelete
130-
Caption = "Delete Item"
130+
Caption = "Delete Item(s)"
131131
End
132132
Begin VB.Menu mnuGeoPosSep1
133133
Caption = "-"
@@ -471,13 +471,15 @@ End Sub
471471

472472
Private Function LBFamousPlaces_GetSelection() As Long()
473473
Dim i As Long, c As Long
474-
ReDim v(0 To LBFamousPlaces.SelCount - 1)
474+
If LBFamousPlaces.SelCount = 0 Then Exit Function
475+
ReDim v(0 To LBFamousPlaces.SelCount - 1) As Long
475476
For i = 0 To LBFamousPlaces.ListCount - 1
476477
If LBFamousPlaces.Selected(i) Then
477478
v(c) = i
478479
c = c + 1
479480
End If
480481
Next
482+
LBFamousPlaces_GetSelection = v
481483
End Function
482484

483485
Private Sub mnuGeoPosDelete_Click()
@@ -486,12 +488,22 @@ Private Sub mnuGeoPosDelete_Click()
486488
' m_FamousPlaces.Remove i + 1
487489
' LBFamousPlaces.RemoveItem i
488490
'remove the items in the collection m_FamousPlaces and in the ListBox LBFamousPlaces
489-
Dim selectedindices() As Long: v = LBFamousPlaces_GetSelection
490-
Dim i As Long
491-
For i = 0 To UBound(selectedindices)
492-
491+
Try: On Error GoTo Catch
492+
Dim selectedIndices() As Long: selectedIndices = LBFamousPlaces_GetSelection
493+
Dim i As Long, u As Long: u = UBound(selectedIndices)
494+
Dim si As Long, c As Long: c = u + 1
495+
Dim s As String: s = "Delete " & c & " element" & IIf(c > 1, "s", "") & " from the list?"
496+
If MsgBox(s, vbOKCancel) = vbCancel Then Exit Sub
497+
For i = u To 0 Step -1
498+
si = selectedIndices(i)
499+
'delete from Collection m_FamousPlaces
500+
m_FamousPlaces.Remove si + 1
501+
'delete from ListBox LBFamousPlaces
502+
LBFamousPlaces.RemoveItem si
493503
Next
494504
'UpdateView
505+
Exit Sub
506+
Catch:
495507
End Sub
496508

497509
Private Sub mnuOptStartGEWeb_Click()
@@ -535,10 +547,17 @@ End Sub
535547
Private Sub mnuAddToTrip_Click()
536548
Dim s As String: s = LBFamousPlaces.Text
537549
If Len(s) = 0 Then MsgBox "Select item first": Exit Sub
538-
Dim gps As GeoPos: Set gps = GetGeoPos(s)
539-
If gps Is Nothing Then Exit Sub
540-
m_Trip.Add gps
541-
LBTrip.AddItem s
550+
Dim selectedIndices() As Long: selectedIndices = LBFamousPlaces_GetSelection
551+
Dim i As Long, u As Long: u = UBound(selectedIndices)
552+
Dim si As Long, gps As GeoPos
553+
For i = 0 To u
554+
si = selectedIndices(i)
555+
s = LBFamousPlaces.List(si)
556+
Set gps = GetGeoPos(s)
557+
If gps Is Nothing Then Exit Sub
558+
m_Trip.Add gps
559+
LBTrip.AddItem s
560+
Next
542561
UpdateTripLengthView
543562
End Sub
544563

PAngleWGS84UTM32.vbp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ HelpContextID="0"
2727
CompatibleMode="0"
2828
MajorVer=2023
2929
MinorVer=6
30-
RevisionVer=2
30+
RevisionVer=5
3131
AutoIncrementVer=0
3232
ServerSupportFiles=0
3333
VersionCompanyName="MBO-Ing.com"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[![GitHub](https://img.shields.io/github/license/OlimilO1402/Math_AngleWGS84UTM32?style=plastic)](https://github.com/OlimilO1402/Math_AngleWGS84UTM32/blob/master/LICENSE)
55
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/OlimilO1402/Math_AngleWGS84UTM32?style=plastic)](https://github.com/OlimilO1402/Math_AngleWGS84UTM32/releases/latest)
6-
[![Github All Releases](https://img.shields.io/github/downloads/OlimilO1402/Math_AngleWGS84UTM32/total.svg)](https://github.com/OlimilO1402/Math_AngleWGS84UTM32/releases/download/v2023.6.2/AngleWGS84UTM32_v2023.6.2.zip)
6+
[![Github All Releases](https://img.shields.io/github/downloads/OlimilO1402/Math_AngleWGS84UTM32/total.svg)](https://github.com/OlimilO1402/Math_AngleWGS84UTM32/releases/download/v2023.6.5/AngleWGS84UTM32_v2023.6.5.zip)
77
![GitHub followers](https://img.shields.io/github/followers/OlimilO1402?style=social)
88

99
Project started in march 2022.

0 commit comments

Comments
 (0)