View previous topic :: View next topic |
Author |
Message |
Edward Neves Newbie cheater Reputation: 0
Joined: 14 May 2022 Posts: 11
|
Posted: Sat May 14, 2022 8:00 am Post subject: my form disappears |
|
|
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
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Sat May 14, 2022 8:49 am Post subject: |
|
|
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 |
|
|
Edward Neves Newbie cheater Reputation: 0
Joined: 14 May 2022 Posts: 11
|
Posted: Sat May 14, 2022 12:05 pm Post subject: |
|
|
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 |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Sat May 14, 2022 12:42 pm Post subject: |
|
|
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 |
_________________
|
|
Back to top |
|
|
Edward Neves Newbie cheater Reputation: 0
Joined: 14 May 2022 Posts: 11
|
Posted: Sat May 14, 2022 1:06 pm Post subject: |
|
|
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 |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Sat May 14, 2022 1:41 pm Post subject: |
|
|
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 |
_________________
|
|
Back to top |
|
|
Edward Neves Newbie cheater Reputation: 0
Joined: 14 May 2022 Posts: 11
|
Posted: Sat May 14, 2022 8:44 pm Post subject: |
|
|
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 |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sat May 14, 2022 9:51 pm Post subject: |
|
|
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 |
|
|
|