• Print

Author Topic: My First Project  (Read 4141 times)

0 Members and 1 Guest are viewing this topic.

Offline FunnyCop

  • Newbie
  • *
  • Posts: 7
  • Karma: 1
My First Project
« on: November 16, 2014, 07:48:43 pm »
I recently started a project to create a new simplified GUI for ULX:



The problem is that this is the first time I've coded anything in lua.

I was wondering if anybody could help me with something.

I've coded the functions for ban and banid by having a text entry box for a name then have a popup to input the time and then have another popup for inputting a reason. (code is below)

Code: Lua
  1. local banname = vgui.Create( "DTextEntry", frame )
  2.         banname:SetParent( ban )
  3.         banname:SetPos( 3, 26 )
  4.         banname:SetSize( 191, 25 )
  5.         banname:SetText( "[Name]" )
  6.         banname.OnEnter = function( n )
  7.                 local bframe = vgui.Create( "DFrame" )
  8.                         bframe:Center()
  9.                         bframe:SetSize( 103, 54 )
  10.                         bframe:SetTitle( "" )
  11.                         bframe:SetVisible( true )
  12.                         bframe:SetDraggable( true )
  13.                         bframe:ShowCloseButton( true )
  14.                         bframe:MakePopup()
  15.                                 function bframe:Paint( w, h )
  16.                                         draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
  17.                                         surface.SetDrawColor( 0, 0, 0 )
  18.                                         surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
  19.                                 end
  20.                 local bfs = vgui.Create( "DTextEntry", bframe )
  21.                         bfs:SetParent( bframe )
  22.                         bfs:SetPos( 3, 26 )
  23.                         bfs:SetSize( 97, 25 )
  24.                         bfs:SetText( "[Minutes]" )
  25.                         bfs.OnEnter = function( m )
  26.                                 local bframe2 = vgui.Create( "DFrame" )
  27.                                         bframe2:Center()
  28.                                         bframe2:SetSize( 103, 54 )
  29.                                         bframe2:SetTitle( "" )
  30.                                         bframe2:SetVisible( true )
  31.                                         bframe2:SetDraggable( true )
  32.                                         bframe2:ShowCloseButton( true )
  33.                                         bframe2:MakePopup()
  34.                                                 function bframe2:Paint( w, h )
  35.                                                         draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
  36.                                                         surface.SetDrawColor( 0, 0, 0 )
  37.                                                         surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
  38.                                                 end
  39.                                 local banm = vgui.Create( "DTextEntry", bframe2 )
  40.                                         banm:SetParent( bframe2 )
  41.                                         banm:SetPos( 3, 26 )
  42.                                         banm:SetSize( 97, 25 )
  43.                                         banm:SetText( "[Reason]" )
  44.                                         banm.OnEnter = function( r )
  45.                                                         RunConsoleCommand( "ulx", "ban", n:GetValue(), m:GetValue(), r:GetValue() )
  46.                                         end
  47.                         end
  48.         end

I would love to have just one text entry box to do all of the work but I can't quite figure out how to make it.

I have attached the entire file at the end of this post.
« Last Edit: November 20, 2014, 07:37:58 pm by FunnyCop »

Offline BobTheDuck69

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
Re: My First Project
« Reply #1 on: March 12, 2015, 12:14:23 pm »
I hope to see this working in the future please release it for us c:
~The friendly neighborhood duckie~

  • Print