Jump to content

What is wrong


tim260

Recommended Posts

What is wrong with this it doesnt create it and doesnt close ( im not so good in GUI )

function build_Form() 
     
    local gui = {} 
    gui._placeHolders = {} 
    local dicht = guiSetVisible ( build_Form, false ) 
      
    local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 842, 498 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 
    showCursor(true) 
     
    gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "Form", false) 
    guiWindowSetSizable(gui["_root"], false) 
     
    gui["tabWidget"] = guiCreateTabPanel(0, 75, 821, 431, false, gui["_root"]) 
     
    gui["tab"] = guiCreateTab("United States Department of Homeland Security ", gui["tabWidget"]) 
     
    gui["plainTextEdit"] = guiCreateMemo(10, 10, 401, 361, "The Department of homeland security was founded in this server by tim260.\n\nIts now lead by tim260 and is not active yet we are devloping it.", false, gui["tab"]) 
    guiMemoSetReadOnly(gui["plainTextEdit"], true) 
  
     
    gui["label_2"] = guiCreateLabel(460, 90, 271, 221, "", false, gui["tab"]) 
    guiLabelSetHorizontalAlign(gui["label_2"], "left", false) 
    guiLabelSetVerticalAlign(gui["label_2"], "center") 
     
    gui["tab_3"] = guiCreateTab("Joining", gui["tabWidget"]) 
     
    gui._placeHolders["line"] = {left = 27, top = 180, width = 751, height = 20, parent = gui["tab_3"]} 
     
    gui["tab_2"] = guiCreateTab("Members", gui["tabWidget"]) 
     
    gui["label"] = guiCreateLabel(290, 25, 411, 31, "Homeland security info panel", false, gui["_root"]) 
    guiLabelSetHorizontalAlign(gui["label"], "left", false) 
    guiLabelSetVerticalAlign(gui["label"], "center") 
     
    return gui, windowWidth, windowHeight 
end 
end 
addCommandHandler ( "homeland", build_Form ) 
  
  
  
function close() 
guiSetVisible(build_Form, false) 
showCursor(false) 
end 
end 
addCommandHandler ( "closehomeland", close ) 

Link to comment

Working :D

    local gui = {} 
    gui._placeHolders = {} 
      
    local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 842, 498 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 
    
    gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "Form", false) 
    guiWindowSetSizable(gui["_root"], false) 
    guiSetVisible(gui["_root"], false) 
    
    gui["tabWidget"] = guiCreateTabPanel(0, 75, 821, 431, false, gui["_root"]) 
    
    gui["tab"] = guiCreateTab("United States Department of Homeland Security ", gui["tabWidget"]) 
    
    gui["plainTextEdit"] = guiCreateMemo(10, 10, 401, 361, "The Department of homeland security was founded in this server by tim260.\n\nIts now lead by tim260 and is  not yet active, as we are developing it.", false, gui["tab"]) 
    guiMemoSetReadOnly(gui["plainTextEdit"], true) 
  
    
    gui["label_2"] = guiCreateLabel(460, 90, 271, 221, "", false, gui["tab"]) 
    guiLabelSetHorizontalAlign(gui["label_2"], "left", false) 
    guiLabelSetVerticalAlign(gui["label_2"], "center") 
    
    gui["tab_3"] = guiCreateTab("Joining", gui["tabWidget"]) 
    
    gui._placeHolders["line"] = {left = 27, top = 180, width = 751, height = 20, parent = gui["tab_3"]} 
    
    gui["tab_2"] = guiCreateTab("Members", gui["tabWidget"]) 
    
    gui["label"] = guiCreateLabel(290, 25, 411, 31, "Homeland security info panel", false, gui["_root"]) 
    guiLabelSetHorizontalAlign(gui["label"], "left", false) 
    guiLabelSetVerticalAlign(gui["label"], "center") 
    
function OpenClose() 
if guiGetVisible(gui["_root"]) == true then 
guiSetVisible(gui["_root"], false) 
showCursor(false) 
elseif guiGetVisible(gui["_root"]) == false then 
guiSetVisible(gui["_root"], true) 
showCursor(true) 
end 
end 
addCommandHandler ( "homeland", OpenClose ) 

Link to comment

Try

local gui = { } 
  
  
function build_Form( ) 
    gui._placeHolders = { } 
     
    local screenWidth, screenHeight = guiGetScreenSize( ) 
    local windowWidth, windowHeight = 842, 498 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 
    showCursor( true ) 
     
    gui["_root"] = guiCreateWindow( left, top, windowWidth, windowHeight, "Form", false ) 
    guiWindowSetSizable( gui["_root"], false ) 
     
    gui["tabWidget"] = guiCreateTabPanel( 0, 75, 821, 431, false, gui["_root"] ) 
     
    gui["tab"] = guiCreateTab( "United States Department of Homeland Security ", gui["tabWidget"] ) 
     
    gui["plainTextEdit"] = guiCreateMemo( 10, 10, 401, 361,  
    [[The Department of homeland security was founded in this server by tim260. 
     
    Its now lead by tim260 and is not active yet we are devloping it. 
    ]], false, gui["tab"] ) 
     
    guiMemoSetReadOnly( gui["plainTextEdit"], true ) 
  
     
    gui["label_2"] = guiCreateLabel( 460, 90, 271, 221, "", false, gui["tab"] ) 
    guiLabelSetHorizontalAlign( gui["label_2"], "left", false ) 
    guiLabelSetVerticalAlign( gui["label_2"], "center" ) 
     
    gui["tab_3"] = guiCreateTab( "Joining", gui["tabWidget"] ) 
     
    gui._placeHolders["line"] = { left = 27, top = 180, width = 751, height = 20, parent = gui["tab_3"] } 
     
    gui["tab_2"] = guiCreateTab( "Members", gui["tabWidget"] ) 
     
    gui["label"] = guiCreateLabel( 290, 25, 411, 31, "Homeland security info panel", false, gui["_root"] ) 
    guiLabelSetHorizontalAlign( gui["label"], "left", false ) 
    guiLabelSetVerticalAlign( gui["label"], "center" ) 
     
    return gui, windowWidth, windowHeight 
end 
addCommandHandler ( "homeland", build_Form ) 
  
  
  
function close( ) 
    destroyElement( gui["_root"] ) 
    gui["_root"] = nil 
    showCursor( false ) 
end 
addCommandHandler ( "closehomeland", close ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...