How would I refresh/reload a DFrame?
This is my code, pretty simple:
for k,group in pairs(ulx.group_names) do
if table.HasValue(encourageUserUserGroups,group) == false and table.HasValue(encourageBlacklistedULXGroups,group) == false and groupIsPurchased == false then
levelingFrame.Buy = vgui.Create("DButton", levelingFrame.Main)
levelingFrame.ListPanel = vgui.Create("DPanel", levelingFrame.Main)
levelingFrame.ListPanel:SetBackgroundColor(Color(50,50,50,200))
levelingFrame.AmountPanel = vgui.Create("DPanel",levelingFrame.Main)
levelingFrame.ListPanel:SetSize( 135, 35 )
levelingFrame.ListPanel:SetPos(0,panelGoingX)
levelingFrame.AmountPanel:SetSize( 40, 35 )
levelingFrame.AmountPanel:SetPos(136,panelGoingX)
levelingFrame.AmountPanel:SetBackgroundColor(Color(50,50,50,200))
levelingFrame.Amount = vgui.Create("DLabel",levelingFrame.AmountPanel)
levelingFrame.List = vgui.Create("DLabel", levelingFrame.ListPanel)
levelingFrame.List:SetText(group)
levelingFrame.List:SetContentAlignment( 5 )
levelingFrame.List:SizeToContents()
levelingFrame.List:CenterHorizontal(0.5)
levelingFrame.List:CenterVertical(0.5)
levelingFrame.Amount:SetText(userGroupAmount)
levelingFrame.Amount:SetContentAlignment( 5 )
levelingFrame.Amount:SizeToContents()
levelingFrame.Amount:CenterHorizontal(0.5)
levelingFrame.Amount:CenterVertical(0.5)
levelingFrame.Buy:SetText("Purchase")
levelingFrame.Buy:SetPos(177,panelGoingX)
levelingFrame.Buy:SetSize(100,35)
levelingFrame.Buy.Paint = function(self, w,h)
draw.RoundedBox(0,0,0,w,h,Color(45,45,45,200))
end
levelingFrame.Buy:SetEnabled(false)
levelingFrame.Buy:SetTextColor( Color( 50, 50, 50, 255 ) )
if staffCoinAmount >= userGroupAmount then
print("yus")
levelingFrame.Buy:SetEnabled(true)
levelingFrame.Buy:SetTextColor( Color( 66, 134, 244, 255 ) )
levelingFrame.Buy.DoClick = function()
if staffCoinAmount >= userGroupAmount then
staffCoinAmount = staffCoinAmount - userGroupAmount
end
end
end
panelGoingX = panelGoingX + 36
end
end
When I press the button, it doesn't show the points changing, I have to re-open the menu for it to change, any way to refresh the entire frame?
I know I don't need to, but after I click the button the button disables itself, however, since the frame isn't refreshed, you can still click the button.
It doesn't appear the GMod Wiki has anything, I searched up reload, refresh, recompute, and it showed nothing I could use.
Thanks for helping me, It honestly means a ton
A DPanel is not getting refreshed like a frame of a game. It stays, until you close it or open a other Dframe.
To have a change on the window it self you need to reopen it.
Any way to do that without making the user re-open the DFrame through the chat command?
I know you would use frame:Close(), but is there like a frame:Open() that I'm unaware about?
Sorry, you need to Log In to post a reply to this thread.