We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
I noticed one bug, that "OnCommand" method/hook doesn't works on Scripted Frame, it works only on Scripted PropertyDialog.
The text was updated successfully, but these errors were encountered:
Interesting. Can you provide some example code of your issue? I'll see what causes this if I can.
Sorry, something went wrong.
Yeah, here the code.
local PANEL = {} local ImAFrame = false -- Switch this to true, for creating Frame. function PANEL:Init(parent, name) self:SetBounds(UTIL.ScreenWidth() / 2, UTIL.ScreenHeight() / 2, 350, 150) self:SetTitle("Panel with button.", true) self.Button = vgui.Button(self, "button", "Kill me!", self, "pKill") self.Button:SetPos(50, 50) end function PANEL:OnCommand(pCmd) if pCmd == "pKill" then engine.ClientCmd("kill") end end if ImAFrame == true then vgui.register(PANEL, "SimplePanel_Frame", "Frame") -- Register as Frame else vgui.register(PANEL, "SimplePanel_Dialog", "PropertyDialog") -- Register as PropertyDialog end local function open() if ( ToPanel( Panel ) == INVALID_PANEL ) then if ImAFrame == true then Panel = vgui.SimplePanel_Frame(VGui_GetClientLuaRootPanel(), "SimplePanel"); else Panel = vgui.SimplePanel_Dialog(VGui_GetClientLuaRootPanel(), "SimplePanel"); end end Panel:Activate(); end concommand.Create("open_panel", open)
Bingo, thanks you found the issue, @Dim1xs.
When I wrote the bindings 11 years ago or so, I didn't create a method on the C++ end to listen to OnCommand hooks for scripted frames:
https://github.com/Planimeter/hl2sb-src/blob/master/src/game/client/scripted_controls/lFrame.cpp
https://github.com/Planimeter/hl2sb-src/blob/master/src/game/client/scripted_controls/lPropertyDialog.cpp#L58-L72
andrewmcwatters
No branches or pull requests
I noticed one bug, that "OnCommand" method/hook doesn't works on Scripted Frame, it works only on Scripted PropertyDialog.
The text was updated successfully, but these errors were encountered: