PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → [WD20] - How to re Init a Entry window without closing it
[WD20] - How to re Init a Entry window without closing it
Started by Yogi Yang, Feb., 19 2018 1:31 PM - 7 replies
Posted on February, 19 2018 - 1:31 PM
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
Posted on February, 19 2018 - 1:44 PM
Hello Yogi.

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

HTH

Gianni
Posted on February, 19 2018 - 1:48 PM
Hello Yogi

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

Regards
Al
Posted on February, 19 2018 - 1:48 PM
Hi

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

Best regards
Posted on February, 19 2018 - 2:26 PM
Hello and Thanks everyone!

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

Regards,
Posted on February, 19 2018 - 3:50 PM
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.
Posted on February, 19 2018 - 5:00 PM
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
Posted on February, 20 2018 - 7:40 AM
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