| Subject |
Re: replace command |
| From |
Ken Mayer <dbase@nospam.goldenstag.net> |
| Date |
Sat, 1 May 2021 16:09:36 -0700 |
| Newsgroups |
dbase.getting-started |
On 5/1/2021 2:02 PM, Gaetano D. wrote:
>
>> Yeah, rowsets and such often don't know what "form" is because they
>> can be used across different forms/reports/etc, but visual controls
>> have to have parents, and so form.entryfield ...
>>
>> Ken
>>
> That makes a little more sense now, but not completely yet. Is there a
> sample in dUFLP or in your books that demonstrates how the same rowset
> is shared between a form and a report?
You can pass a reference in a form. The code in the report would have to
be overridden to get it, but I don't have a simple example handy, no. It
takes work ... either using an associative array (if you need to pass
multiple items) or some other value, in a form's pushbutton event
handler you might do (completely untested):
function MyButton_onClick()
set procedure to myReport.rep
r = new myReportReport()
r.MyRowset = form.rowset
// make the report not MDI so the preview window doesn't
// allow focus to switch (at least in theory):
r.mdi := false
// whatever else
r.render()
return
In the report's overridden render() method:
// overriding it, the report designer calls it "form_render()" here,
// an oddity, but nothing to worry about:
function form_render()
if type( "this.MyRowset " ) # "U" // it's not undefined
this.streamsource1.rowset = this.MyRowset
endif
return MyReportREPORT::render()
In theory this should work. However, you cannot close the form if it
releases the query the rowset is associated with ... you could also use
the preview form in the dUFLP, but you'd still have to deal with the
overridden render and all that ...
Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
|
|