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

Passing a parameter from one frame to the next

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
skippy295
General User
General User


Joined: 01 Aug 2010
Posts: 10

PostPosted: Tue Aug 03, 2010 5:57 pm    Post subject: Passing a parameter from one frame to the next Reply with quote

OK I'm sure this can be done, just I don't have enough experience with the API yet... Could anyone please tell me how I call a frame from another frame and pass a parameter from the first frame to the second?

Thanks
Back to top
View user's profile Send private message
QuazzieEvil
Super User
Super User


Joined: 17 Jan 2007
Posts: 599
Location: Houston, TX

PostPosted: Wed Aug 04, 2010 4:56 am    Post subject: Reply with quote

what do you mean by frame? do you refer to a database form document? or a document frame (com.sun.star.frame.Frame)?
_________________
Free Docs @ http://www.baseprogramming.com/resources.html
Book @ lulu.com http://www.lulu.com/content/2455551
Back to top
View user's profile Send private message Visit poster's website
skippy295
General User
General User


Joined: 01 Aug 2010
Posts: 10

PostPosted: Wed Aug 04, 2010 6:04 pm    Post subject: Reply with quote

ok...Sorry I'm working with database form documents. Embarassed
Back to top
View user's profile Send private message
QuazzieEvil
Super User
Super User


Joined: 17 Jan 2007
Posts: 599
Location: Houston, TX

PostPosted: Thu Aug 05, 2010 4:51 am    Post subject: Reply with quote

No problem.

Opening another form: In Base 3+ (and if your macro is saved inside the database document), a form can be opened like this:

Code:

 ThisDatabaseDocument.FormDocuments.getByName("<form name").open()


Now, if you want to do anything with this form, store a reference to the form document. Then, access the form of choice from the Forms collection in the draw page.
Once you have the form, set any value of the form control by accessing the respective control.

Code:

Dim FormDoc As Object
Dim Forms As Object
Dim oForm As Object
Dim Age As Integer
Dim dbDoc As Object

dbDoc=ThisDatabaseDocument
Age=104
FormDoc= dbDoc.FormDocuments.getByName("<form name>").open()
Forms=FormDoc.DrawPage.Forms
oForm=Forms.getByIndex(0) REM get first form.
oForm.getByName("Age").BoundField.updateInt(Age) REM update age
REM oForm.getByName("FirstName").BoundField.updateString("Charles")


If your code is not inside a database document, then the variable ThisDatabaseDocument is not available. In that case you need to get access to it somehow.

If your code is triggered by an form event, for example, the global variable ThisComponent refers to the active form document--just make sure to store a reference to it right away--should your code activate another document. The database document is the Parent of the form document.



Code:

Sub cmd_test(Event As Object)
   Dim FormDoc As Object
  Dim DBDoc As Object

  FormDoc=ThisComponent
  DBDoc=FormDoc.Parent
 REM proceed as before.
End Sub

_________________
Free Docs @ http://www.baseprogramming.com/resources.html
Book @ lulu.com http://www.lulu.com/content/2455551
Back to top
View user's profile Send private message Visit poster's website
skippy295
General User
General User


Joined: 01 Aug 2010
Posts: 10

PostPosted: Sat Aug 07, 2010 3:48 am    Post subject: Reply with quote

Very Happy Thanks QuazzieEvil... You have just dug me out of a very deep hole and saved me more time than you can possibly imagine!
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 Base 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