I can't find any lua documentation on these functions and have been unable to use them properly, When I save the panel into a variable then call upon it to set the current tab on reopen it deselects all of the tabs.
Could anyone assist please?
Here is the debug output:
[code]
save
Panel: 2CBEEBC0
restore
Panel: 2CBEEBC0
[/code]
If i understand your question correctly, what you want to do is have it so when you close a menu and reopen it, it returns you to the tab that you were on.
The problem i think your running in to is when you close your derma menu you use :Close() witch will actually delete the menu itself, so when you reopen it( when its being re-created) the menu creates new tabs. the new tabs are different from the old tabs and have a different value( so when you close it the tab might be "Panel: 2CBEEBC0" but when you re-create it, it would be something else and hte old value would be pointing to something that does not exist anymore)
if you are creating a menu that doesn't have any data on it that will ever change you can just use the function "SetVisible" on the main derma when ever you want to show or hide it.
But if you want to recreate the derma every time and want it to return to the same tab you can use this badly coded system i made to do that :
[lua]
local openedtab = 1
function dermamenu( open )
if open then -- will create the derma
--<create your derma stuff here>
--this would be after you add all your things to a propertysheet
for k ,v in pairs(PropertySheet.Items) do
if k == openedtab then
PropertySheet:SetActiveTab(v.Tab)
end
end
else -- were closing the derma
for k ,v in pairs(PropertySheet.Items) do
if v.Tab == PropertySheet:GetActiveTab() then
openedtab = k
end
end
mainderma:Close()
end
end
-- does work on Q
concommand.Add( "+menu", function() createqmenu( 1 ) end )
concommand.Add( "-menu", function() createqmenu( 2 ) end )
[/lua]
Sorry, you need to Log In to post a reply to this thread.