Simplicty and flexibility!

documentclose , openform, refreshform

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

documentclose , openform, refreshform

Download: Dataease Fehler.docx

I always get errors, what is wrong? see the attacment. I want a to clear the Form "AUFTRAG" but not ClearForm(), but ClearForm("AUFTRAG") from a button in a second document.

Written by Rainer 23/06/19 at 10:49:29 Dataease [{8}]FIVE

Re:documentclose , openform, refreshform

Hallo Rainer,

habe dein Problem gesehen.. Ich denke bei der Anweisung Wait(0.1) musst Du einen Punkt und kein Komma verwenden! :)

Grüße aus dem Rheinland....


Written by Markus 23/06/19 at 20:22:37 Dataease [{8}]FIVE

Re:documentclose , openform, refreshform

Ahh sorry ... Und müsste es nicht FormClear sein ?.....

Gruß Markus

Written by Markus 23/06/19 at 20:31:56 Dataease [{8}]FIVE

Re:Re:documentclose , openform, refreshform


it is much easier +documentclose()+refreshform() that works

Written by Rainer 23/06/19 at 22:06:41 Dataease [{8}]FIVE

Re:documentclose , openform, refreshform

All numbers in programming need to be in "English" i.e. .(period) rather than , (comma). This was changed in 7.2 so code would not be affected by windows settings. Compied code was never affected but actions (i.e. button code) is interpreted so it would have worked in germany but not in England and vice versa.

ExecDQL is also interpreted so problem even bigger in 8.0 onwards. so always . in code.

After looking at your derviation it is a little hard to judge what you try to do.

DocumentClose() does not support documentname in 8.x. We added DocumentCloseName() which will do this in 8.5

The problem in DFW (Windows really) is that actions is sent on the BUS as signals so you are not 100% sure in which order they are executed and they will ALWAYS be executed in the Active Window as this is where WIndows send its signals.

So in theory you could send a DocumentClose() signal when your DE app was inactive and Word was active and the Window with the word document would receive the signal.

So if you get a GPF when trying to do
DocumentClose()+DocumentOpen("New Document") that is because both signals was sent to active window, the window is the closed and the environment that DocumenetOpen is supposed to be executed in no longer exists and hence it call illegal memory and GPF.

RE: +documentclose()+refreshform() 

I gather what you do here is to add/modify in one window and then want the result updated in the underlying window.

This works basically because the RefreshForm() signal is sent to the active window which is the last one behind the one you close.

It is an optimistic approach as it will only work as long as windows are done in the right order.

The control of windows and process has radically improved in DE9 but already in DE8.5 you can control this much more specifically.

You have a SetCurrent("ActiveDoc","DocumentName") that will switch (bring to front) a  specific Window. PS! it will switch to the first window with CAPTION = DocumentName  so you can even change to "LIVE REPORT : AUFTRAG_RE" or "DESIGN FORM : System - Info" . 

PPS! In DE9 you will be able to read the specific WinID for each Window and also Switch to that specific ID.

So the combination of 
SetCurrent("ActiveDoc","Auftrag")+DocumentCloseName("LIVE REPORT : AUFTRAG_RE")+RefreshForm()

Written by DataEase 25/06/19 at 13:02:19 Dataease [{8}]FIVE