Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How To Create an Instance Varilable for a DataWindow in a Non-Visual Object

389 views
Skip to first unread message

Aubrey C. Eichel

unread,
Dec 20, 2004, 2:43:29 PM12/20/04
to
I am trying to create an instance of a Standard Visual DataWindow object
in a Custom Non-Visual object.

I have found messages in the newsgroups that indicate a datastore should
be used, but I have not found any that indicate whether or not this can
be done.

I understand that using datastores is the preferred approach, but
unfortunately, we are in one of those legacy quandaries that prevent us
from doing things as we would like.

If anyone can tell us how, if at all we can create the DW, it would be
appreciated.

Thanks,
Aubrey

Scott Morris

unread,
Dec 20, 2004, 3:34:25 PM12/20/04
to
You can't directly. A visual object must be created with "openuserobject"
and generally needs GUI information of various types (such as a parent). If
you must use a datawindow, then you will need to create it (and host it) on
a window (whether visible or not). If you find this approach necessary,
then perhaps you should reconsider your design. Instead of a NVO class that
"contains" a datawindow, you may find it easier to design / implement a
datawindow service class (where you "register" the service class object with
the datawindow - or vice versa, depending on your perspective / goals).

"Aubrey C. Eichel" <Aubrey...@noSXCspam.com> wrote in message
news:41c72b5b$1@forums-2-dub...

Aubrey C. Eichel

unread,
Dec 20, 2004, 3:50:31 PM12/20/04
to
Thanks for your prompt design Scott. The reason we want to use the DW
is because an existing NVO has a function that is passed a DW. Because
we are now using DSs in other parts of the application, we wanted to
overload the function in the NVO, pass it a DS, copy the data to a DW
and then call the original function. That way, we would only need to
make the one minor change to the NVO, and all future development could
use DSs to call it.

Such is life. As we don't want to redesign the NVO, I guess we will
have to figure out a method of having the calling objects create the DW
and pass it.

Thanks again for your help Scott,
Aubrey

dawntbrowneyes

unread,
Dec 20, 2004, 5:34:55 PM12/20/04
to
I am not sure what you are trying to do but this may help:

a button calls the function wf_retrieve
for a datawindow and then a datastore:

wf_retrieve(dw_1)
messagebox('datawindow',string(dw_1.rowcount()))

datastore ls
ls = create datastore
ls.dataobject = 'd_header2'
wf_retrieve(ls)
messagebox('datastore',string(ls.rowcount()))

The function wf_retrieve passes the object
by reference then determines what it is and
retrieves it:

public function integer wf_retrieve (ref powerobject
aobject);
datawindow ldw
datastore lds

choose case aobject.typeof()
case datawindow!
ldw = aobject
ldw.settransobject(sqlca)
ldw.retrieve()
case datastore!
lds = aobject
lds.settransobject(sqlca)
lds.retrieve()
end choose

return 0

Aubrey C. Eichel

unread,
Dec 20, 2004, 7:13:26 PM12/20/04
to
Thank you very much for your reply. Your suggestion is an approach that
we would rather not take. As mentioned in my reply to Scott, we have an
existing NVO with a function that has DataWindow as an argument. Our
goal is to be able to pass DataStores to that function without changing
the object, other than to overload the function. If we could create a
DW within the NVO, we could overload the existing function with a
function using a DataStore as an argument. We would then create and
populate the DW from the DS, and call the original function using the
newly created DW.

Although your example works great, it would mean changes to the function
that we are trying to avoid changing.

Appreciate your help though Dawn,
Aubrey

Bede

unread,
Dec 21, 2004, 3:26:38 AM12/21/04
to
what if you create the dw on a window (eg. the main frame window) and
keep a reference to that dw on your nvo?
be careful for memory leaks though, when the nvo is destroyed you shd
destroy the dw too.

e.g. the window could have a function of_createDW(string dataobject)
that returns a datawindow (or powerobject)

// openuserobject + hide on window

// set dataobject

Return dw

on the nonvisual declare instance var:
datawindow idw_data

get a reference to that window and call the function
idw_data = lw_parent.of_createDW("d_data")

HTH,

Ben

In article <41c72b5b$1@forums-2-dub>, Aubrey...@noSXCspam.com
says...

0 new messages