Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
Reset a form
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Anyone know how to change...
by
Blaazen
[
Today
at 04:10:31 pm]
Lazarus visual components
by
Onur2x
[
Today
at 04:09:52 pm]
How to save greek letters...
by
jamie
[
Today
at 03:55:38 pm]
Control inside control...
by
Espectr0
[
Today
at 03:55:05 pm]
SQL - looks easy but I ca...
by
Thaddy
[
Today
at 03:27:34 pm]
Yet another FPC/embedded ...
by
DavidL
[
Today
at 03:06:34 pm]
InterProcessCommunication...
by
440bx
[
Today
at 02:46:07 pm]
Habari STOMP Clients 202...
by
mjustin
[
Today
at 02:34:11 pm]
JSON count how many array...
by
paweld
[
Today
at 01:22:12 pm]
Opencv version 4.6 C++ AP...
by
gidesa
[
Today
at 01:09:27 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Reset a form (Read 239 times)
MJ12
Newbie
Posts: 5
Reset a form
«
on:
December 11, 2022, 04:51:22 pm »
hello!
Im new to programming in general and I wanted to create the fifteen puzzle so copied the code from this link:
https://wiki.freepascal.org/15-puzzle
Everything worked fine but I wanted to implement a reset button. What i found online was this:
Form1.free;
Application.CreateForm(TForm1, Form1)
I created the button and at the end i put the code but it was debugging infinitely.
Any ideas on how to make it work?
Logged
af0815
Hero Member
Posts: 1170
Re: Reset a form
«
Reply #1 on:
December 11, 2022, 05:52:19 pm »
I think, you must not free and recreate the form. You have only to change/refresh the puzzle15 (TGameBoard)
a ) init all like in TGameBoard.Create (all old information is lost by this)
b ) Set new positions you can use TGameBoard.RandomArray
Logged
regards
Andreas
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
Reset a form
TinyPortal
© 2005-2018