Jump to content

onClientGUIClick button


BriGhtx3

Recommended Posts

Posted

Hey,

I have got another problem.

I've create a GUI, now when I click the button HInv_BTN_Platzieren, the function textITT should get executed. But the function gets executed whenever I click on the GUI or the gridlist...

HInv_Window = guiCreateWindow(354,252,362,272,"Inv",false) 
guiWindowSetSizable(HInv_Window,false) 
HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) 
guiGridListSetSelectionMode(HInv_Grid,2) 
  
hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) 
HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) 
addEventHandler("onClientGUIClick",HInv_BTN_Platzieren,function() if source == HInv_BTN_Platzieren then guiSetVisible(HInv_Window,false) textITT() end end) 
  
function textITT() 
outputChatBox("TEXT") 
end 
  

Posted
Hey,

I have got another problem.

I've create a GUI, now when I click the button HInv_BTN_Platzieren, the function textITT should get executed. But the function gets executed whenever I click on the GUI or the gridlist...

HInv_Window = guiCreateWindow(354,252,362,272,"Inv",false) 
guiWindowSetSizable(HInv_Window,false) 
HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) 
guiGridListSetSelectionMode(HInv_Grid,2) 
  
hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) 
HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) 
addEventHandler("onClientGUIClick",HInv_BTN_Platzieren,function() if source == HInv_BTN_Platzieren then guiSetVisible(HInv_Window,false) textITT() end end) 
  
function textITT() 
outputChatBox("TEXT") 
end 
  

and It ?

HInv_Window = guiCreateWindow(354,252,362,272,"Inv",false) 
guiWindowSetSizable(HInv_Window,false) 
HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) 
guiGridListSetSelectionMode(HInv_Grid,2) 
  
hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) 
HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) 
  
function click() 
 if (source == HInv_BTN_Platzieren) then  
guiSetVisible(HInv_Window,false)  
outputChatBox("TEXT") 
            end  
     end 
) 
addEventHandler("onClientGUIClick", click) 

Guest Guest4401
Posted

But the function gets executed whenever I click on the GUI or the gridlist...

@BriGhtx3

Your code is absolutely fine. I tested it and it only executes when you click the button. Can you recheck it please?

Posted (edited)
kenix in the last weekend I learn about scripting introduction , introduction the gui and the addeventhandler

You need learn again!

addEventHandler("onClientGUIClick", click) 

What is it?!!

function click() 
 if (source == HInv_BTN_Platzieren) then  
guiSetVisible(HInv_Window,false)  
outputChatBox("TEXT") 
            end  
     end 
) 

And it

:/

Edited by Guest
Posted
kenix in the last weekend I learn about scripting introduction , introduction the gui and the addeventhandler

Baby_Facepalm_Poster_by_Nianden.jpg

Posted

That's not Off-Topic.

"It's really sad when your own baby knows that you're a dumbass...." -> That's the pure true.

Posted

Did you guyz know it's about BriGhtX3, not about ElMota...

BriGhtx3, check your script, it looks fine and karthik184 said he looked at it.

Posted

I checked it again.

It still doesn't work :/

I also set getPropagated to true, but it is still the same.

I also tested it on another computer and it doesn't work there as well.

Posted
I checked it again.

It still doesn't work :/

I also set getPropagated to true, but it is still the same.

I also tested it on another computer and it doesn't work there as well.

its will working.. /debugscript 3?

  • Scripting Moderators
Posted

Try this:

addEventHandler ( "onClientGUIClick", HInv_BTN_Platzieren, 
function ( ) 
    guiSetVisible ( HInv_Window, false ) 
    textITT ( ) 
end, false ) 

Posted

Just use:

addEventHandler ( 'onClientGUIClick', root, 
    function ( ) 
        if ( source == HInv_BTN_Platzieren ) then 
            guiSetVisible ( HInv_Window, false ) 
            textITT() 
        end 
    end 
) 

lol

Posted

Doesn't work either.

I changed the code a bit and it doesn't work either. Could someone fix it?

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) 
  
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() if source == HInv_BTN_Platzieren then guiSetVisible(HInv_Window,false) TextITT() end end,false) 
  

Posted (edited)

Try this:

HInv_Window = guiCreateWindow(354,252,362,272,"Haushaltsinventar",false) 
guiWindowSetSizable(HInv_Window,false) 
--Label 
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") 
--Grid 
HInv_Grid = guiCreateGridList(38,69,290,157,false,HInv_Window) 
guiGridListSetSelectionMode(HInv_Grid,2) 
hinvName = guiGridListAddColumn(HInv_Grid,"Name",2) 
--Button 
HInv_BTN_Platzieren = guiCreateButton(90,231,186,22,"Platzieren",false,HInv_Window) 
centerWindow(HInv_Window) 
  
addEventHandler("onClientGUIClick",HInv_BTN_Platzieren,function() 
    if(source == HInv_BTN_Platzieren)then 
        guiSetVisible(HInv_Window,false) 
        textITT() 
    end 
end,false) 

Edited by Guest

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