Jump to content

onClientGUIClick button


BriGhtx3

Recommended Posts

  • Scripting Moderators
function centerWindow ( center_window ) 
    local screenW, screenH = guiGetScreenSize ( ) 
    local windowW, windowH = guiGetSize ( center_window, false ) 
    local x, y = ( screenW-windowW )/2, ( screenH-windowH )/2 
    guiSetPosition ( center_window, x, y, false ) 
end 
  
HInv_Window = guiCreateWindow ( 354, 252, 362, 272, "Haushaltsinventar", false ) 
guiWindowSetSizable ( HInv_Window, false ) 
HInv_LBL_Welcome = guiCreateLabel ( 34, 25, 305, 35, "Hallo. Das ist dein Haushaltsinventar.\nVon hier aus kannst du M?bel in dein Haus platzieren.", false, HInv_Window ) 
guiSetFont ( HInv_LBL_Welcome, "default-bold-small" ) 
HInv_Grid = guiCreateGridList ( 38, 69, 290, 157, false, HInv_Window ) 
guiGridListSetSelectionMode ( HInv_Grid, 2 ) 
  
guiSetVisible ( HInv_Window, true ) 
  
hinvName = guiGridListAddColumn ( HInv_Grid, "Name", 2 ) 
HInv_BTN_Platzieren = guiCreateButton ( 90, 231, 186, 22, "Platzieren", false, HInv_Window ) 
centerWindow ( HInv_Window ) 
  
addEventHandler ( "onClientGUIClick", HInv_BTN_Platzieren, 
function ( ) 
    guiSetVisible ( HInv_Window, false ) 
    textITT ( ) 
end, false ) 
  
function textITT ( ) 
outputChatBox ( "TEXT" ) 
end 

Link to comment

try this:

hi_window = guiCreateWindow(354,252,362,272,"Haushaltsinventar",false) 
guiWindowSetSizable(hi_window,false) 
--Label 
hi_lbl = guiCreateLabel(34,25,305,35,"Hallo. Das ist dein Haushaltsinventar.\nVon hier aus kannst du Möbel in dein Haus platzieren.",false,hi_window) 
guiSetFont(hi_lbl,"default-bold-small") 
--Grid 
hi_grid = guiCreateGridList(38,69,290,157,false,hi_window) 
guiGridListSetSelectionMode(hi_grid,2) 
hinvName = guiGridListAddColumn(hi_grid,"Name",2) 
--Button 
hi_btn = guiCreateButton(90,231,186,22,"Platzieren",false,hi_window) 
centerWindow(hi_window) 
  
addEventHandler("onClientGUIClick",root,function(button) 
    if(button=="left")then 
        if(source==hi_btn)then 
            guiSetVisible(hi_window,false) 
            textITT() 
        end 
    end 
end,false) 

I know what was wrong

Link to comment

Tested and works perfectly.

HInv_Window = guiCreateWindow(354,252,362,272,"Haushaltsinventar",false) 
guiWindowSetSizable(HInv_Window,false) 
HInv_LBL_Welcome = guiCreateLabel(34,25,305,35,"Hallo. Das ist dein Haushaltsinventar.\nVon hier aus kannst du Möbel in dein Haus platzieren.",false,HInv_Window) 
guiSetFont(HInv_LBL_Welcome,"default-bold-small") 
HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) 
guiGridListSetSelectionMode(HInv_Grid,2) 
centerWindow(HInv_Window) 
  
hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) 
HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) 
  
function textITT() 
outputChatBox("TEXT") 
end 
  
addEventHandler( "onClientGUIClick" ,root, 
function() 
    if (source == HInv_BTN_Platzieren) then 
    guiSetVisible ( HInv_Window, false ) 
    textITT() 
end 
end) 
  

Link to comment

try this:

hi_window = guiCreateWindow(354,252,362,272,"Haushaltsinventar",false) 
guiWindowSetSizable(hi_window,false) 
guiSetVisible(hi_window,true) 
--Label 
hi_lbl = guiCreateLabel(34,25,305,35,"Hallo. Das ist dein Haushaltsinventar.\nVon hier aus kannst du Möbel in dein Haus platzieren.",false,hi_window) 
guiSetFont(hi_lbl,"default-bold-small") 
--Grid 
hi_grid = guiCreateGridList(38,69,290,157,false,hi_window) 
guiGridListSetSelectionMode(hi_grid,2) 
hinvName = guiGridListAddColumn(hi_grid,"Name",2) 
--Button 
hi_btn = guiCreateButton(90,231,186,22,"Platzieren",false,hi_window) 
centerWindow(hi_window) 
  
addEventHandler("onClientGUIClick",guiRoot,function(button) 
    if(button=="left")then 
        if(source==hi_btn)then 
            guiSetVisible(hi_window,false) 
            textITT() 
        end 
    end 
end,false) 
  
function textITT() 
    outputChatBox("TEXT") 
end 

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...