New Window - Reset

I am try to find the right way how to do it
In my app i have a toolbar with 1 button “New”
So if the user click it to renew the window and start again.
What is best procedure to do it?
Bring each value from controls 1 by 1 to default values or is other way more easy?
i know is noob question but i must ask !!

Bring each value from controls 1 by 1 to default values

Thank you @Emile_Schwarz Emile

You have an alternate way to do that:

iterate all Controls on the window and clear them (in a Loop) using ISA…

ControlCount returns the number of controls,

Adapt the code:


For Each c As DesktopControl In Self.Controls
  If c IsA DesktopTextField Then
    DesktopTextField(c).Text = "" // One line for each Control Type
  End If
Next

From the LR.

https://documentation.xojo.com/api/user_interface/desktop/desktopwindow.html

You could just make a new window and close the one you no longer want.

1 Like

This may appears as a strange thing (like a flash or…).

Of course, the user may prefer to close the window and use File --> New. Not knowing the software, it is hard to say.