OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Closing dialog from button on another dialog

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
wpeter2002
OOo Enthusiast
OOo Enthusiast


Joined: 08 Apr 2007
Posts: 145

PostPosted: Mon Jun 11, 2007 5:18 am    Post subject: Closing dialog from button on another dialog Reply with quote

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
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon Jun 11, 2007 9:01 am    Post subject: Reply with quote

Your dialog has to be a non modal dialog if you want to close it from an other dialog. See :
Non-Modal Dialogs http://www.oooforum.org/forum/viewtopic.phtml?t=14095&highlight=
non-modal dialog(sloved in Java) http://www.oooforum.org/forum/viewtopic.phtml?t=43653
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
wpeter2002
OOo Enthusiast
OOo Enthusiast


Joined: 08 Apr 2007
Posts: 145

PostPosted: Mon Jun 11, 2007 9:56 am    Post subject: Reply with quote

SergeM,
Thank you for your reply. I didn't realise that I was opening such a "can of worms". Would my problem be solved by using a multi-page dialog instead of separate dialogs?

Best regards

Peter
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group