Activate Panel/Frame only if You press button

I want to create a button which will be activated only if a panel exist.
I was thinking it will be something like
[lua]
if IsValid(Panel) then
activate button
end
[/lua]

But I don’t know how to keep a panel/frame close until you click on a button.

Umm, panel:SetVisible(false)?

I didn’t tought to that. I will try and let you know if this worked.

[editline]29th May 2013[/editline]

This worked thanks.