KB no longer maintained - MapViewer is a Legacy Product. Legacy Products are still supported, but no longer receive new features or updates. Many of MapViewer's features have been moved to Surfer. Please contact support@goldensoftware.com with any questions. |
To run this script:
- Copy the text below, from the Dim L1() As String start line to the End Function end line.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines.
- Press Ctrl+V to paste your copied script over top of these existing lines.
- Click Script | Run to run the script.
**************
Dim L1() As String 'string array for the first listbox
Dim L2() As String 'string array for the second listbox
Sub Main
' initialize the first listbox strings
ReDim L1(3)
L1(0) = "item 0"
L1(1) = "item 1"
L1(2) = "item 2"
L1(3) = "item 3"
' set up the UserDialog structure
Begin Dialog UserDialog 400,203,"example",.dlgF1 ' %GRID:10,7,1,1
MultiListBox 10,7,130,147,L1(),.list1
MultiListBox 250,7,130,140,L2(),.list2
PushButton 160,35,70,21,"Add =>",.btnAdd
OKButton 300,175,90,21
End Dialog
' display the dialog
Dim dlg As UserDialog
Dialog dlg
End Sub
' this dialogfunc processes events from the dialog
Function dlgF1(itm$,act%,Val%) As Boolean
Dim i, cnt As Integer
Select Case act%
Case 2 'listbox change or button press
If itm$ = "btnAdd" Then ' Add button pressed
cnt = UBound(DlgValue("list1")) ' # strings to move - 1
ReDim L2(cnt)
' move the strings from L1 to L2
For i = 0 To cnt
L2(i) = L1(DlgValue("list1")(i))
Next
' update the 2nd listbox
DlgListBoxArray "list2",L2
dlgF1 = True 'leave dialog open
ElseIf itm$ = "OK" Then
dlgF1 = False 'close dialog
End If
End Select
End Function
Updated January 4, 2019
Comments
0 comments
Please sign in to leave a comment.