wpeter2002 OOo Enthusiast

Joined: 08 Apr 2007 Posts: 145
|
Posted: Mon Jun 11, 2007 5:18 am Post subject: Closing dialog from button on another dialog |
|
|
I am putting together a simple Calc application which leads the user through a selection process. On dialog1 I have a button which, when pressed, loads a ComboBox on dialog2 with a list of entries which it obtains from a sheet called “SheetB”. The code below causes dialog2 to open with its ComboBox containing the appropriate drop-down list entries. My problem is: how do I close dialog1 from this code? I have tried lots of alternatives but without success.
All advice gratefully received.
Best regards
Peter
| Code: | Option Explicit
Dim oDialog2 as Object
Sub load_Range
DialogLibraries.LoadLibrary("Standard")
oDialog2 = createUnoDialog( DialogLibraries.Standard.Dialog2 )
load_listbox
oDialog2.execute
End Sub
Sub load_listbox
Dim oSheet
Dim oCell
Dim oList2 as Object
Dim c as Integer
Dim First as String
Dim Second as String
Dim Third as String
Dim Fourth as String
Dim Fifth as String
oList2 = oDialog2.getControl("ComboBox2")
oSheet = ThisComponent.getSheets().getByName("SheetB")
If oSheet.getCellByPosition(2,1).String <> "" Then
oCell = oSheet.getCellByPosition(2,1)
oList2.AddItem (oCell.String,0)
End If
First = oSheet.getCellByPosition(2,1).String
If oSheet.getCellByPosition(2,2).String <> "" Then
oCell = oSheet.getCellByPosition(2,2)
End If
Second = oSheet.getCellByPosition(2,2).String
If Second <> First Then
oList2.AddItem (oCell.String, 1)
End If
If oSheet.getCellByPosition(2,3).String <> "" Then
oCell = oSheet.getCellByPosition(2,3)
End If
Third = oSheet.getCellByPosition(2,3).String
If Third <> Second Then
If Third <> First Then
oList2.AddItem(oCell.String, 2)
End If
End If
If oSheet.getCellByPosition(2,4).String <> "" Then
oCell = oSheet.getCellByPosition(2,4)
End If
Fourth = oSheet.getCellByPosition(2,4).String
If Fourth <> Third Then
If Fourth <> Second Then
If Fourth <> First Then
oList2.AddItem(oCell.String, 3)
End If
End If
End If
If oSheet.getCellByPosition(2,5).String <> "" Then
oCell = oSheet.getCellByPosition(2,5)
End If
Fifth = oSheet.getCellByPosition(2,5).String
If Fifth <> Fourth Then
If Fifth <> Third Then
If Fifth <> Second Then
If Fifth <> First Then
oList2.AddItem(oCell.String, 4)
End If
End If
End If
End If
End Sub
|
|
|