BriGhtx3 Posted April 8, 2012 Author Share Posted April 8, 2012 I know that ;D I put it in my code The GUI is centered and the function works. Jaysday your code doesn't work as well Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 I know that ;DI put it in my code The GUI is centered and the function works. Jaysds your code doesn't work as well Is this all your script? Link to comment
BriGhtx3 Posted April 8, 2012 Author Share Posted April 8, 2012 What do you mean? oO This is the full code in this file Link to comment
Scripting Moderators Sarrum Posted April 8, 2012 Scripting Moderators Share Posted April 8, 2012 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
BriGhtx3 Posted April 8, 2012 Author Share Posted April 8, 2012 Tried it: doesn't work You didn't change anything oO You just inserted the centerWindow function, right? Link to comment
Scripting Moderators Sarrum Posted April 8, 2012 Scripting Moderators Share Posted April 8, 2012 Tried it: doesn't work I tested it, works. Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 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
Smart. Posted April 8, 2012 Share Posted April 8, 2012 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
BriGhtx3 Posted April 8, 2012 Author Share Posted April 8, 2012 Lol I just don't get it Tried both codes and they don't work. Link to comment
BriGhtx3 Posted April 8, 2012 Author Share Posted April 8, 2012 I would always post the errors if there were any ;D Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 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
BriGhtx3 Posted April 8, 2012 Author Share Posted April 8, 2012 What is guiRoot? I tried the script in your last post and turned off all resources. Now it works. Thank you Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 What is guiRoot?Thank you guiRoot is a new predefined variable: Predefined_variables_list and your welcome 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