| View previous topic :: View next topic |
| Author |
Message |
skippy295 General User

Joined: 01 Aug 2010 Posts: 10
|
Posted: Tue Aug 03, 2010 5:57 pm Post subject: Passing a parameter from one frame to the next |
|
|
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 |
|
 |
QuazzieEvil Super User

Joined: 17 Jan 2007 Posts: 599 Location: Houston, TX
|
|
| Back to top |
|
 |
skippy295 General User

Joined: 01 Aug 2010 Posts: 10
|
Posted: Wed Aug 04, 2010 6:04 pm Post subject: |
|
|
ok...Sorry I'm working with database form documents.  |
|
| Back to top |
|
 |
QuazzieEvil Super User

Joined: 17 Jan 2007 Posts: 599 Location: Houston, TX
|
Posted: Thu Aug 05, 2010 4:51 am Post subject: |
|
|
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 |
|
 |
skippy295 General User

Joined: 01 Aug 2010 Posts: 10
|
Posted: Sat Aug 07, 2010 3:48 am Post subject: |
|
|
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 |
|
 |
|