DComboBox Problem

function NPCMenu()

local Weapon_Selection_Menu = vgui.Create("DFrame")
Weapon_Selection_Menu:SetSize(402, 295)
Weapon_Selection_Menu:SetTitle("Weapon Selection Menu")

local PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( Weapon_Selection_Menu )
PropertySheet:SetPos(4.5, 26.5)
PropertySheet:SetSize(394, 264)
local SheetItemOne = vgui.Create( "DComboBox" )
SheetItemOne:SetPos( 10, 35 )
SheetItemOne:SetSize( 50, 100 )
SheetItemOne:AddItem( "AK-47" ) -- Add our options
SheetItemOne:AddItem( "Pulse Rifle" )
SheetItemOne:AddItem( "M4-A1" )
SheetItemOne:AddItem( "Random" )
local SheetItemTwo = vgui.Create( "DComboBox" )
SheetItemTwo:SetPos( 10, 35 )
SheetItemTwo:SetSize( PropertySheet:GetWide() - 5, PropertySheet:GetTall() - 5 )
SheetItemTwo:AddItem( "Desert Eagle" ) -- Add our options
SheetItemTwo:AddItem( "357 Magnum" )
SheetItemTwo:AddItem( "Pernach" )
SheetItemTwo:AddItem( "Random" )

PropertySheet:AddSheet( "Automatics", SheetItemOne, "gui/silkicons/user", false, false, "AutoMatic Guns" )
PropertySheet:AddSheet( "Pistols", SheetItemTwo, "gui/silkicons/user", false, false, "Handheld Pistols" ) 
PropertySheet:AddSheet( "Snipers", SheetItemThree, "gui/silkicons/user", false, false, "Sniper Rifles" )

concommand.Add(“GunDealer”, NPCMenu)
Anyone see problems? The combo boxes take up the entire property sheet even though their size is set to close to half of what the property sheets size is.

Whatever panel you send to the “AddSheet” function will automatically be stretched to the size of the DPropertySheet.

Instead of adding the DComboBox directly, parent the DComboBox to a DPanel and then add the DPanel.

You lost me with the last sentence “Instead of adding the DComboBox directly, parent the DComboBox to a DPanel and then add the DPanel.” are you basically just saying don’t parent the property sheet?

He means Don’t add the DComboBox directly to the prop sheet, parent the DComboBox to a Dpanel and add the Dpanel to the prop sheet. I’m not even sure if you can parent a prop sheet xD.

Lol, thanks for the help, I understand it more clearly now.


Except if any of you would care to make the DPanel for me…I always have troubles making anything with property sheets in it

[lua]local sheetone = vgui.Create(“DPanel”)
local combobox = vgui.Create(“DComboBox”,sheetone)
– do things with the combobox here
propertysheet:AddSheet(“Sheet One”,sheetone,“gui/silkicons/user”,false,false,"")[/lua]

Could you add it to my code =\ >< feeling really stupid ><

If you don’t know how to implement that I suggest you take a step back and actually learn what you’re doing, rather than copy+pasting menus from the wiki.

I know how when I posted that I was really tired and a little stoned.