esporta05 Posted July 22, 2014 Share Posted July 22, 2014 Here is the debug log screen shot http://i.imgur.com/yBbuKJf.png function Information (button) MainWindow = guiCreateWindow ( 0.2, 0.20, 0.55, 0.5, "Information", true ) --Main Window MainCloseButton = guiCreateButton(0.6747, 0.1599, 0.075, 0.04, "CLOSE", true) local TabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, MainWindow ) local RuleTab = guiCreateTab( "Rules", TabPanel ) local CommandTab = guiCreateTab( "Commands", TabPanel ) guiCreateMemo(15,10,1000,420,"Deatmatching is'nt allowed! \nbla bla bla!",false,RuleTab) --Main/Rules Window Text guiCreateMemo(15,10,1000,420,"This part was too long so I dont put this part to the forum.",false,CommandTab) --Commands Window Text end addCommandHandler ("info",Information) addEventHandler ( "onClientGUIClick", MainCloseButton, CloseButton, false ) --run closebuyon function function CloseButton (button) guiSetVisible(MainWindow, false)--close the mainwindow gui end Link to comment
12p Posted July 22, 2014 Share Posted July 22, 2014 Just a matter of ordering your stuff. Creating your windows should be done only once; not attached to any function at all. When you need them (typing the command), you use that guiSetVisible function to make the window appear. And when you click the button, you make it disappear. tl;dr this should work btw, why isn't MainCloseButton attached to MainWindow? local MainWindow = guiCreateWindow(0.2, 0.20, 0.55, 0.5, "Information", true) local MainCloseButton = guiCreateButton(0.6747, 0.1599, 0.075, 0.04, "CLOSE", true) local TabPanel = guiCreateTabPanel(0, 0.1, 1, 1, true, MainWindow) local RuleTab = guiCreateTab("Rules", TabPanel) local CommandTab = guiCreateTab("Commands", TabPanel) guiCreateMemo(15, 10, 1000, 420, "Deatmatching is'nt allowed! \nbla bla bla!", false, RuleTab) --Main/Rules Window Text guiCreateMemo(15, 10, 1000, 420, "This part was too long so I dont put this part to the forum.", false, CommandTab) guiSetVisible(MainWindow, false) function CloseButton () guiSetVisible(MainWindow, false) end addEventHandler("onClientGUIClick", MainCloseButton, CloseButton, false) function Information() guiSetVisible(MainWindow, true) end addCommandHandler ("info", Information) Link to comment
esporta05 Posted July 22, 2014 Author Share Posted July 22, 2014 For your question: I tried to attach button to the windows but it get dissepeated. local MainCloseButton = guiCreateButton(0.6747, 0.1599, 0.075, 0.04, "CLOSE", true,MainWindow) I tried to attach it as same as I saw in the wiki but it get dissepeared all the time without any debug errors. thank you for your help, if you can tell me whats wrong with the button I will really appreciate it. Link to comment
12p Posted July 22, 2014 Share Posted July 22, 2014 Ahhhh, dumb me. That's because you had the button outside the window It's okay like that, but you must add a guiSetVisible for the button in each function (close and open) Link to comment
esporta05 Posted July 22, 2014 Author Share Posted July 22, 2014 Even I dont set a guisetvisible for my button it is getting enabled in resource start. and I put my button inside of my windows but still I cant attach it to my window Link to comment
Max+ Posted July 23, 2014 Share Posted July 23, 2014 --Client local MainWindow = guiCreateWindow(0.2, 0.20, 0.55, 0.5, "Information", true) local MainCloseButton = guiCreateButton(0.6747, 0.1599, 0.075, 0.04, "CLOSE", true, MainWindow) local TabPanel = guiCreateTabPanel(0, 0.1, 1, 1, true, MainWindow) local RuleTab = guiCreateTab("Rules", TabPanel) local CommandTab = guiCreateTab("Commands", TabPanel) guiCreateMemo(15, 10, 1000, 420, "Deatmatching is'nt allowed! \nbla bla bla!", false, RuleTab) --Main/Rules Window Text guiCreateMemo(15, 10, 1000, 420, "This part was too long so I dont put this part to the forum.", false, CommandTab) guiSetVisible(MainWindow, false) addEventHandler ( 'onClientGUIClick', resourceRoot, function ( ) if ( source == MainCloseButton ) then guiSetVisible(MainWindow, false) end end ) addCommandHandler ('info', function ( ) if ( guiGetVisible ( MainWindow == true )) then guiSetVisible(MainWindow, false) showCursor ( false ) else guiSetVisible(MainWindow, true) showCursor ( true ) end end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now