Re-open DFrame after having been closed

Is it possible to re-open a DFrame once it has been closed with the X button?

Use **[DFrame.SetDeleteOnClose

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=DFrame.SetDeleteOnClose)**.

Because that totally opens it again.

DFrame:MakePopup() would probably be what you’re looking for.

What mean delete on close? there is no already delete when we closing the frame or it’s only make disappear until we call the frame ?

Under normal conditions, derma frames remove itself as soon asthey’re closed.
But because you want to make the panel show up again after it has been closed, you can either:

  1. Recreate the panel.
  2. Reopen the last used panel.

If you choose option one, you should simply re-run the lua code again that creates the panel.
If you choose option two, things will get a little more advanced.
First of all, you’ll have to make sure that the derma frame doesn’t delete itself but just hides. This can be done using **[DFrame.SetDeleteOnClose

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=DFrame.SetDeleteOnClose)**
Now, after you’ve closed the panel it will hide. But how do you make it show up again? Well, that’s what **[Panel.SetVisible

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Panel.SetVisible)** and **[Panel.MakePopup

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Panel.MakePopup)** do. They makes the panel visible again and enables the cursor.

Example code:
[lua]
local DFrame = vgui.Create(“DFrame”) --Create our derma frame
DFrame:SetSize(256, 128) --Set the size, 256 pixels wide, 128 pixels tall.
DFrame:Center() --Center the panel in the middle of the screen.
DFrame:SetTitle(“My testing frame.”) --Make a title show up on top of the frame
DFrame:SetDeleteOnClose(false) --Make sure that our frame doesn’t delete itself after it’s closed.
DFrame:SetVisible(false) --We don’t want the panel to be visible when we load the script, but only when we run the below function.

–You can use this function to make the panel show up at any time.
–To run it via console: type ‘lua_run_cl OpenDaPanel()’
function OpenDaPanel()
–Set our panel visible and make our panel show up.
DFrame:SetVisible(true)
DFrame:MakePopup()
end
[/lua]

I apology for my earlier uninformative reply, I was a bit in a hurry for school.
Feel free to ask any other questions.

I’ve closed frames and just used MakePopup() before and had no issues, I don’t see why you need SetDeleteOnClose

If you don’t have that, ‘DFrame’ will become NULL when the X button is clicked

Thanks! SetVisible() was the missing piece of the puzzle.