Cocodrilo Posted May 1, 2013 Share Posted May 1, 2013 hi all, i would like to know how to make when i click the botton change the StaticImage ... ( I just want to change it for another one in the same position ) .. another one image : IMAGENGOBERNADOR = guiCreateStaticImage(225, 242, 208, 219, "mono2.png", false, PANEL) GUIEditor = { label = {} } if showw == false then local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 661, 528 local left = (screenWidth-windowWidth)/2 local top = (screenHeight-windowHeight)/2 PANEL = guiCreateWindow(left,top,windowWidth,windowHeight, "", false) guiWindowSetSizable(PANEL, false) BANNER = guiCreateStaticImage(9, 18, 642, 163, "banner.png", false, PANEL) IMAGENRICK = guiCreateStaticImage(225, 242, 208, 219, "mono.png", false, PANEL) GUIEditor.label[1] = guiCreateLabel(260, 208, 163, 34, "Selecciona un Personaje", false, PANEL) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 173, 244, 98) BOTONLEFT = guiCreateButton(190, 350, 26, 23, "", false, PANEL) guiSetAlpha(BOTONLEFT, 0.20) BOTONRIGHT = guiCreateButton(440, 350, 26, 23, "", false, PANEL) guiSetAlpha(BOTONRIGHT, 0.20) BOTONIMAGEN = guiCreateButton(225, 242, 208, 219, "", false, PANEL) guiSetAlpha(BOTONIMAGEN, 0.20) showw = false showCursor(true) end Link to comment
PaiN^ Posted May 1, 2013 Share Posted May 1, 2013 Use : 'onClientGUIClick' -- event ! guiSetVisible Link to comment
Cocodrilo Posted May 1, 2013 Author Share Posted May 1, 2013 I added this at end but doesn't work what's wrong? function gob( ) guiSetVisible( IMAGENRICK, true ) guiSetVisible( IMAGENGOBERNADOR, false ) end addEventHandler("onClientGUIClick", BOTONRIGHT , gob, false) Link to comment
فاّرس Posted May 1, 2013 Share Posted May 1, 2013 addEventHandler("onClientGUIClick", BOTONRIGHT , function() guiSetVisible( IMAGENRICK, true ) -- Showing guiSetVisible( IMAGENGOBERNADOR, false ) -- Hiding end) Link to comment
Cocodrilo Posted May 1, 2013 Author Share Posted May 1, 2013 Works!! but if i want to add another one third image.. how to change the second image to the third? Link to comment
فاّرس Posted May 1, 2013 Share Posted May 1, 2013 Works!! but if i want to add another one third image.. how to change the second image to the third? use : else and see this : Button = guiCreateButton(30,340,113,46,"choose",false); Pic = guiCreateStaticImage(230,30,134,289,"1.png",false); local load = load addEventHandler("onClientGUIClick",Button, function ( ) if not ( load ) then guiStaticImageLoadImage ( Pic, "1.png" ); load = not load; else guiStaticImageLoadImage ( Pic, "2.png" ); load = not load; end; end,false ); Link to comment
iPrestege Posted May 1, 2013 Share Posted May 1, 2013 local images = { "1.png","2.png","3.png" } local id = 1 addEventHandler("onClientGUIClick",BOTONRIGHT, function ( ) if id then id = id + 1 else id = id - 1 end if id < 1 then id = #images end if id > #images then id = 1 end guiStaticImageLoadImage ( BOTONRIGHT , images [ id ] ) end,false ) Try it . Link to comment
Cocodrilo Posted May 1, 2013 Author Share Posted May 1, 2013 Button = guiCreateButton(30,340,113,46,"choose",false); Pic = guiCreateStaticImage(230,30,134,289,"1.png",false); local load = load addEventHandler("onClientGUIClick",Button, function ( ) if not ( load ) then guiStaticImageLoadImage ( Pic, "1.png" ); load = not load; else guiStaticImageLoadImage ( Pic, "2.png" ); load = not load; end; end,false ); @Mr.Pres[T]ege @TheBesti took this code and works, Thank you su much !! Link to comment
iPrestege Posted May 1, 2013 Share Posted May 1, 2013 ^ Where is x,y,z for images ? There's no need read the wiki. Link to comment
فاّرس Posted May 1, 2013 Share Posted May 1, 2013 @Mr.Pres[T]ege How showing the image if it's do not have x ,y,x and where is guiCreateStaticImage ? Button = guiCreateButton(30,340,113,46,"choose",false); Pic = guiCreateStaticImage(230,30,134,289,"1.png",false); local load = load addEventHandler("onClientGUIClick",Button, function ( ) if not ( load ) then guiStaticImageLoadImage ( Pic, "1.png" ); load = not load; else guiStaticImageLoadImage ( Pic, "2.png" ); load = not load; end; end,false ); @Mr.Pres[T]ege @TheBesti took this code and works, Thank you su much !! You're welcome. Link to comment
Sasu Posted May 1, 2013 Share Posted May 1, 2013 @Mr.Pres[T]ege How showing the image if it's do not have x ,y,x and where is guiCreateStaticImage ? Button = guiCreateButton(30,340,113,46,"choose",false); Pic = guiCreateStaticImage(230,30,134,289,"1.png",false); local load = load addEventHandler("onClientGUIClick",Button, function ( ) if not ( load ) then guiStaticImageLoadImage ( Pic, "1.png" ); load = not load; else guiStaticImageLoadImage ( Pic, "2.png" ); load = not load; end; end,false ); @Mr.Pres[T]ege @TheBesti took this code and works, Thank you su much !! You're welcome. Read the example on the wiki: guiStaticImageLoadImage Link to comment
iPrestege Posted May 1, 2013 Share Posted May 1, 2013 @ Sasuke This is my code i give it to some one on the arabic section and the code should work fine! 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