TOPIC: Passing an 'id' to an Access1?
#1586
Passing an 'id' to an Access1? 10 Months, 2 Weeks ago
I have a read only browse that responds to a double click. I would like to pass the selected id from the browse (which I have access to) to a control 'LogbookControl' that is an Access1. Then have the Access1 query only the given record.

How can I pass the id from the Browse event to my Access1 control:

Code:


  List_DoubleClick(row,col) {
    id = .logbook.GetBrowseData()[row].l_id
    Dialog(0, LogbookControl) // How to send id???
  }



Then in LogbookControl:
Code:


#(Access1 'logbook where l_id=????' // How to use id???
  ... controls ...
)



Thanks for any tips,

Jeremy
 
 
#1588
Re:Passing an 'id' to an Access1? 10 Months, 2 Weeks ago
The basic idea is to build the query dynamically:

MyAccess1

Code:

Access1
    {
    New(id)
        {
        super("logbook where l_id=" $ Display(id))
        }
    ...


You can then use this via:

Code:

Dialog(.Window.Hwnd, Object("MyAccess1", id))

Note that you have to use Object rather than # because it's not a constant.

Alternately, instead of inheriting from Access1, you can make a Controller and construct the Access1 control dynamically.

AccessGoTo in stdlib does something similar, except it goes to one record in an Access, not to Access1.
 
 
Last Edit: 2009/10/07 20:47 By andrew.
 
andrew