Author Topic: Need help with a Custom Menu!!!  (Read 2931 times)

0 Members and 1 Guest are viewing this topic.

Offline xSylar

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Need help with a Custom Menu!!!
« on: July 22, 2013, 02:14:38 PM »
I am trying to make a menu and I am getting Script errors that I have no idea what they are.
here is the Code
Code: [Select]
local BackGround = vgui.Create( "DFrame" )
BackGround:SetSize( 1000,500 )
BackGround:SetPos( 50,50 )
BackGround:SetTitle("Menu")
BackGround:SetDraggable( true )
BackGround:ShowCloseButton( true )
BackGround:MakePopup()
BackGround:SetVisible( true )
BackGround.Paint
draw.RoundedBox( 6, 100, 50, 100, 23, Color( 255, 255, 255, 150 ) )

I dont understand really the code of the RoundedBox so i just took it off the Gmod Wiki.
Here is the errror

Quote
[ERROR] lua/autorun/client/menu.lua:10: '=' expected near 'draw'
  1. unknown - lua/autorun/client/menu.lua:0


Please help!!

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Need help with a Custom Menu!!!
« Reply #1 on: July 22, 2013, 05:47:32 PM »
if you want to modify the paint hook of the DFrame control you have to do it inside of a function. Try this:

Code: [Select]
BackGround.Paint = function()
    draw.RoundedBox( 6, 100, 50, 100, 23, Color( 255, 255, 255, 150 ) )
end

Offline xSylar

  • Newbie
  • *
  • Posts: 12
  • Karma: -1
Re: Need help with a Custom Menu!!!
« Reply #2 on: July 23, 2013, 08:11:09 PM »
if you want to modify the paint hook of the DFrame control you have to do it inside of a function. Try this:

Code: [Select]
BackGround.Paint = function()
    draw.RoundedBox( 6, 100, 50, 100, 23, Color( 255, 255, 255, 150 ) )
end


Thanks it helped a lot.
and you would you know how to fix a DComboBox

Code: [Select]
local TestingComboBox = vgui.Create( "DComboBox", BackGround )
TestingComboBox:SetPos( 10, 35 )
TestingComboBox:SetSize( 100, 185 )
TestingComboBox:SetMultiple( false )
TestingComboBox:AddItem( "Add" ) -- Add our options
TestingComboBox:AddItem( "Some" )
TestingComboBox:AddItem( "Options" )
TestingComboBox:AddItem( "Here" )

and the SetMultiple is an error
a nill value or something close to that

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Need help with a Custom Menu!!!
« Reply #3 on: July 23, 2013, 10:01:33 PM »
This control was modified for GMod13.

Take a look at the official wiki.
http://wiki.garrysmod.com/page/Libraries/vgui/element/DComboBox

I can tell by the example that you used that you're using the old wiki. This one may have more documentation, but its sometimes outdated. Always check the new wiki too.