Unclickable buttons when parented

Im having this really weird issue with DButtons where if i parent the button to Anything the button becomes unclickable
This is the function i use to create the button


function CreateButton(x, y, w, h, t, db, bc, p)
    p = p or nil

    Index[Count(Index)+1] = vgui.Create("DPanel", p)
    Index[Count(Index)]:SetPos(x, y)
    Index[Count(Index)]:SetSize(w, h)
    Index[Count(Index)]:SetBackgroundColor(bc)

    Index[Count(Index)+1] = vgui.Create("DButton", p)
    Index[Count(Index)]:SetPos(x, y)
    Index[Count(Index)]:SetSize(w, h)
    Index[Count(Index)]:SetText(t)
    --Index[Count(Index)]:SetFont("Font1")
    Index[Count(Index)]:SetTextColor(white)
    Index[Count(Index)]:SetDrawBackground(db)
    return Index[Count(Index)]

end

The first panel is to make a nice looking panel and a hidden button on top. All help appreciated


(User was banned for this post ("Wrong section, try Developer Discussion next time" - Shendow))

Use DFrame, not dpanel, either way you will have to run SetEnableMouseInput and MakePopup()

Also SetDrawBackground is deprecated. Use

DPanel:SetPaintBackground