PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD20] - How to re Init a Entry window without closing it
[WD20] - How to re Init a Entry window without closing it
Débuté par Yogi Yang, 19 fév. 2018 13:31 - 7 réponses
Posté le 19 février 2018 - 13:31
Hello,

I am finding it hard to explain as to what I want but let me try.

I have a well designed Data Entry Window.

When the user clicks on Validate button it validates the data and save the entered data to a file and closes.

Now the users want an option where it I should save the entered to a file and become blanks again to that they can enter new data in it without having to close the window and then reopen it.

How can we keep Window open and reInitialize (make it blank) after saving user entered data?

I hope I have managed to explain my requirement.

TIA
Posté le 19 février 2018 - 13:44
Hello Yogi.

If i understand well your requirement, To reinitialize a form after a save, use "Reset ()"

HTH

Gianni
Posté le 19 février 2018 - 13:48
Hello Yogi

If you also need to run the init code of the window fields then InitWindow() will be required.

Regards
Al
Posté le 19 février 2018 - 13:48
Hi

and/or you can do an executeprocess(WindowName, trtInit)

Best regards
Posté le 19 février 2018 - 14:26
Hello and Thanks everyone!

It is working. Only thing that I had to add was HFlush("*") after saving data.

Regards,
Posté le 19 février 2018 - 15:50
Quote
Yogi Yang

Hello and Thanks everyone!

It is working. Only thing that I had to add was HFlush("*") after saving data.

Regards,

In my opinion, I don't think hFlush alone will do it. All hFlush does is commit the data to disk. It does not clear out all the data on the screen or prefill any mandatory data, etc.
Posté le 19 février 2018 - 17:00
I would agree with Art

What I do is

In the window global declaration

Declare a Record type variable - MyContact is a Record of Contact

Bind each window control 'by Variable' to MyContact
In the whenever modifying code block of each control use ControlToSource()

Following your Save add the code
HresetVariable(MyContact) //Reset all columns to their default values
SourceToScreen(MyWindow,MyContact) //Refresh the displayed values
Posté le 20 février 2018 - 07:40
Quote
Art Bonds

In my opinion, I don't think hFlush alone will do it. All hFlush does is commit the data to disk. ...
That is exactly what I had to do because after re-initializing the window when a user selected an Invoice I have to show calculations as to what was the last invoiced amount as well as total amount of all invoices for a given financial year, and this was coming wrong until I used hFlush.

TIA