DE8 form close & execute options
DE8 form close & execute options
In DE6.53 an OML script can be set as a clicked action to close the form containing the button and open a new document(form, procedure or report).
Example:
-----------------------------
t := RecordSave() .
message concat( "Closing Form ", getglobal(40)) . --window "TEST oml exit 2" .
t := documentclose() .
if getglobal(40) not = "SampleDefaults" then
t := OpenForm(getglobal(40)) .
end
---------------------------
The idea is to close the active form and open another doc based on the data result populating global(40) .
This works fine in DE6.53.
In DE8 it crashes.
Removal of the documentclose() statement allows it not to crash but then the active form obviously does not close.
in DE8 Is there another way of closing the active form and allowing for another doc to open?
Thought that this could be an option
Function lexicon indicates that Documentclose() function can take a parameter to close a specific document.
retval:=DocumentClose()
DocumentClose("Name") -- Will close document with TITLE i.e. what you see on titlebar/Tab and not documentname as name.
Unfortunately that does not work - Documentclose() function is still the same as before - no parameter
https://www.dataease.com/dg3_HelpView/?PageID=1372...
ocumentCloseName(DocumentName)
DocumentCloseName("Full Windows Document Name i.e. Caption"
DocumentCloseName("Customers")
DocumentClsoeName("Customers via Orderform")
DocumentCloseName("DESIGN FORM : Customers")
retval := DocumentCloseName(data-entry fie
To close a document by "remote". Many times when you have open a form for information or run a report/procedure with output, you want that document to be closed. If focus has been returned to another document this is not always straight forward so we have added DocumentCloseName() so you can close a document from anywhere in an app.
If the document in name is already closed or does not exist no action will be taken, and no error message returned.
In 6.x all these functions are CDFs which are handled differently. Also 6.x was built in Borland C/C++ with a lot of handling differently. This was one of the biggest problems for people moving from 6.x to 7.x that things simply didn't work the same way in WIndows C/C++ as in Borland C/C++.
All communication in DFW is done to active window so when you close the window while still executing code on it, you basically cut the three under you. So what you need to do is to open the new window and then close the previous window with DocumentCloseName() from the new window.
There are a lot of stuff to handle windows in DE8 where you can check and set active windows etc.
Managed to get working.
it seems the combination of documentclose() & OpenForm(getglobal(40)) was the issue.
replaced OpenForm with DocumentOpen(getglobal(40))
Works perfectly! :)
Thank you for the other options.
Will check.
It is a combination of send and post in WIndows. OpenForm is an "Old" function that work different to OpenDocument().
There is lots of challenges around this as DFW was never designed for this usage. It was why Actions was single and OML was not part of Express. But there is plenty of workarounds and when one understand what is what you can do whatever you want.