Simplicty and flexibility!


DE8 form close & execute options


Started by Sam Bird
Search
You will need to Sign In to be able to add or comment on the forum!

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?


Written by Sam Bird 07/10/22 at 10:48:16 DataEase Generation 3

Re:DE8 form close

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


Written by Sam Bird 07/10/22 at 11:30:34 DataEase Generation 3

Re:Re:DE8 form close

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.


Written by DataEase 07/10/22 at 13:35:57 DataEase Generation 3

Re:Re:Re:DE8 form close

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.


Written by DataEase 07/10/22 at 13:36:40 DataEase Generation 3

Re:Re:Re:Re:DE8 form close

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.


Written by Sam Bird 07/10/22 at 14:03:45 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:DE8 form close

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.


Written by DataEase 07/10/22 at 20:43:30 Dataease [{8}]FIVE
DG3_ForumList