Files
EgtUILib/SelectMulti.vb
T
Dario Sassi 699879e2c5 EgtUILib 1.5j2 :
- aggiunta gestione analisi
- aggiunta gestione distanza tra punti notevoli.
2014-10-14 06:55:29 +00:00

85 lines
2.7 KiB
VB.net

Imports System.Windows.Forms
Imports EgtUILib.EgtInterface
Public Class SelectMulti
Dim m_nGseContext As Integer
Dim m_nCurrEnt As Integer
Private Sub SelectMulti_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ListBox1.BeginUpdate()
'Inserisco le entità nel mirino
Dim nId = EgtGetFirstSelectedObj(m_nGseContext)
While nId <> GDB_ID_NULL
Dim sTitle As String = String.Empty
EgtGetTitle(m_nGseContext, nId, sTitle)
If EgtIsSelectedObj(m_nGseContext, nId) Then
sTitle += "*"
End If
sTitle += " (" & nId & ")"
Dim smItem As New SelMulItem(sTitle, nId)
ListBox1.Items.Add(smItem)
nId = EgtGetNextSelectedObj(m_nGseContext)
End While
'Inserisco None per non selezionare alcunchè
Dim smNone As New SelMulItem("None", GDB_ID_NULL)
ListBox1.Items.Add(smNone)
ListBox1.EndUpdate()
m_nCurrEnt = GDB_ID_NULL
ListBox1.SelectedIndex = 0
End Sub
Private Sub SelectMulti_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
EgtResetMark(m_nGseContext, m_nCurrEnt)
EgtDraw(m_nGseContext)
End Sub
Public Sub SetContext(ByVal nGseContext As Integer)
m_nGseContext = nGseContext
End Sub
Public Function GetId() As Integer
Return m_nCurrEnt
End Function
Private Sub OK_Click(sender As System.Object, e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub ListBox1_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
If e.KeyData = Keys.Escape Then
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End If
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
EgtResetMark(m_nGseContext, m_nCurrEnt)
m_nCurrEnt = ListBox1.SelectedItem.m_nId
EgtSetMark(m_nGseContext, m_nCurrEnt)
EgtDraw(m_nGseContext)
End Sub
End Class
Public Class SelMulItem
Public m_sTitle As String
Public m_nId As Integer
Public Sub New(ByVal sTitle As String, ByVal nId As Integer)
Me.m_sTitle = sTitle
Me.m_nId = nId
End Sub
Public Overrides Function ToString() As String
Return m_sTitle
End Function
End Class