Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


my form disappears

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Edward Neves
Newbie cheater
Reputation: 0

Joined: 14 May 2022
Posts: 11

PostPosted: Sat May 14, 2022 8:00 am    Post subject: my form disappears Reply with quote

Hello how are you? I'm new to the forum and I'm studying CE.

my problem is to create a form and call it by a button, making it appear is easy but when I close it I can't make it reappear using visible or show() it's like the form is destroyed

Code:

local Form1 = createForm()

local Form2 = createForm(false)


local button = createButton(Form1)
button.caption = "Open"

button.onClick = function()
Form2.visible = true
end


please help me almost 2 days with this Sad
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Sat May 14, 2022 8:49 am    Post subject: Reply with quote

This will make the button function toggle the visibility of form2:
Code:

local Form1 = createForm()

local Form2 = createForm(false)


local button = createButton(Form1)
button.caption = "Open"

button.onClick = function()
Form2.visible = not Form2.Visible

if form2.Visible then
  button.Caption = 'Hide'
else
 button.Caption = 'Show'
end

end
Back to top
View user's profile Send private message
Edward Neves
Newbie cheater
Reputation: 0

Joined: 14 May 2022
Posts: 11

PostPosted: Sat May 14, 2022 12:05 pm    Post subject: Reply with quote

friend thanks for the answer, but is there a way to close and then open? I even managed to do what you did, but my goal is to be able to close the window and then be able to open it again by the button. if you know help me please
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Sat May 14, 2022 12:42 pm    Post subject: Reply with quote

Code:
if Form1 then Form1.Destroy() Form1=nil end
if Form2 then Form2.Destroy() Form2=nil end
Form1 = createForm()
Form1.caption="Form 1"

Form2 = createForm(false)
Form2.caption="Form 2"

local button1 = createButton(Form1)
button1.caption = "Open"

local button2 = createButton(Form2)
button2.caption = "Open"

button2.onClick = function()
Form2.Hide()
Form1.Show()
end

button1.onClick = function()
Form1.Hide()
Form2.Show()
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Edward Neves
Newbie cheater
Reputation: 0

Joined: 14 May 2022
Posts: 11

PostPosted: Sat May 14, 2022 1:06 pm    Post subject: Reply with quote

Hi Aylince, I always see your comments here friend. my problem is when I open another form and close it by clicking the "x". Because I can't seem to get him to show up again. my goal is to do the same as programs that can open a window and close it to open later by pressing the button.



Code:

Form1 = createForm()
Form1.caption="Form 1"

Form2 = createForm(false)
Form2.caption="Form 2"

local button1 = createButton(Form1)
button1.caption = "Open"

local check = createCheckBox(Form2)

button1.onClick = function()
Form2.Show()
end

checkButton = function()
if check.checked then
print("I checked the checkbox, now I can close form2 by clicking the 'x' which will remain checked")
end
end

Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Sat May 14, 2022 1:41 pm    Post subject: Reply with quote

Code:
if Form1 then Form1.Destroy() Form1=nil end
if Form2 then Form2.Destroy() Form2=nil end
Form1 = createForm()
Form1.caption="Form 1"

Form2 = createForm(false)
Form2.caption="Form 2"

local button1 = createButton(Form1)
button1.caption = "Open"

local check = createCheckBox(Form2)
check.caption = "Closing confirmation"


Form2.onClose = function()
 if check.Checked==true then
  Form2.Hide()
  else
  showMessage("Please tick the checkbox to turn it off.")
 end
end

button1.onClick = function()
--Form1.Hide()
Form2.Show()
end

Form1.onClose=function()
--CloseCE()
--return cafree
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Edward Neves
Newbie cheater
Reputation: 0

Joined: 14 May 2022
Posts: 11

PostPosted: Sat May 14, 2022 8:44 pm    Post subject: Reply with quote

Thank you friend, it helped me a lot and I'm sure it will help other people. Success I'll be here helping and learning too
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat May 14, 2022 9:51 pm    Post subject: Reply with quote

Just add a little logic script on Aylin function script to make it better.

Code:
...
..
button1.onClick = function()
--Form1.Hide()
Form2.Show()
check.Checked=false
end
..
..

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites