ihr kennt doch die Auswahlmenus die z.B. bei OOo im Base Modul bei den ganzen Wizards eingesetzt werden. Da wo man 2 große Listboxen hat, und mit Pfeilen lassen sich alle bzw. einzelne Einträge von einer Box in die andere Bewegen.
Genau sowas bräuchte ich, und habe auch schon was Programmiert. Nur leider verhällt sich mein Programm sehr "komisch".
Einträge verändern sich, werden tw. doppelt aufgeführt und tw gar nicht bewegt.
Es wäre nett wenn sich den Code mal jemand anschauen könnte!
Danke!
Code: Alles auswählen
REM ***** BASIC *****
Dim oConnect as Object
Dim oDat as Object
Dim oxStatement as Object
Dim oDia as Object
Dim oErgebnis as Object
Sub Start
Dim oDK as Object
oDK = createUnoService( "com.sun.star.sdb.DatabaseContext" )
oDat = oDK.getByName ( "neu" )
If Not oDat.isPasswordRequired Then
oConnect = oDat.GetConnection("","")
Else
InteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
oConnect = oDat.ConnectWithCompletion(InteractionHandler)
End If
DialogLibraries.loadLibrary ("Standard")
oDia = CreateUnoDialog(DialogLibraries.Standard.Test)
' zaehler = 1
oDia.execute()
End Sub
Sub Beenden
oDialog.endExecute()
If Not IsNull(oErgebnis) then
oErgebnis.close()
End If
If Not IsNull(oxStatement) then
oxStatement.close()
End If
If Not IsNull(oConnect) then
oConnect.close()
End If
End Sub
Sub datenSatzRechts
Dim items(4) as String
Dim position(4) as Integer
Dim x as Long
' b = oDia.getControl("ListBox1").ItemCount
items() = oDia.getControl("ListBox1").SelectedItems
position() = oDia.getControl("ListBox1").SelectedItemspos()
for i = lbound(position()) to ubound(position())
oDia.getControl("ListBox1").removeItems(position(i), 1)
' MsgBox position(i)
next i
oDia.getControl("ListBox2").addItems(items(), 1)
End Sub
Sub datenSatzRechtsAlle
Dim items(4) as String
Dim b
b = oDia.getControl("ListBox1").ItemCount
items() = oDia.getControl("ListBox1").Model.stringItemList
oDia.getControl("ListBox2").addItems(items(), 1)
oDia.getControl("ListBox1").removeItems(0, b)
End Sub
Sub alleDatensatzLoeschen
Dim items(4) as String
Dim b
b = oDia.getControl("ListBox2").ItemCount
items() = oDia.getControl("ListBox2").Model.stringItemList
oDia.getControl("ListBox1").addItems(items(), 1)
oDia.getControl("ListBox2").removeItems(0, b)
End Sub
Sub datensatzLoeschen
Dim items(4) as String
Dim position(4) as Integer
Dim x as Long
b = oDia.getControl("ListBox2").ItemCount
items() = oDia.getControl("ListBox2").SelectedItems
position() = oDia.getControl("ListBox2").SelectedItemspos()
for i = lbound(position()) to ubound(position())
oDia.getControl("ListBox2").removeItems(position(i), 1)
' MsgBox position(i)
next i
oDia.getControl("ListBox1").addItems(items(), 1)
End Sub