FWCentral Posted May 10, 2012 Share Posted May 10, 2012 I want a GUI to slide in from the side how can i do it? Link to comment
Wei Posted May 10, 2012 Share Posted May 10, 2012 this is my sample. Just edit guiSetAlphat to guiSetPosition. bindKey("F3","down",function() guiSetVisible(window,not guiGetVisible(window)) guiSetAlpha( window, 0) setTimer( function() guiSetAlpha( window, 0.1 ) end , 100, 1) setTimer( function() guiSetAlpha( window, 0.2 ) end , 2000, 1) setTimer( function() guiSetAlpha( window, 0.3 ) end , 300, 1) setTimer( function() guiSetAlpha( window, 0.4 ) end , 400, 1) setTimer( function() guiSetAlpha( window, 0.5 ) end , 500, 1) setTimer( function() guiSetAlpha( window, 0.6 ) end , 600, 1) setTimer( function() guiSetAlpha( window, 0.7 ) end , 700, 1) setTimer( function() guiSetAlpha( window, 0.8 ) end , 800, 1) setTimer( function() guiSetAlpha( window, 0.9 ) end , 900, 1) setTimer( function() guiSetAlpha( window, 1 ) end , 1000, 0) showCursor(guiGetVisible(window)) end) Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 Thanks for that, Im using it differently for a spawn GUI though but thanks Another question, How can i check if a gridlist already has a row with the same name? Like say i make a command /addrow [ROWNAME] And then i type /addrow FWCentral then again i type /addrow FWCentral how can i check if there is already one to stop it? Link to comment
CapY Posted May 10, 2012 Share Posted May 10, 2012 I want a GUI to slide in from the side how can i do it? Take a look at arc_'s client_anim library, it is located in the "race" resource. Example of usage: Animation.createAndPlay(pict, { from = 0, to = 100, time = 2000, fn = guiMove }) Where the 'pict' is an GUI element. Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 I don't need help with the sliding anymore thanks CapY, I need to know how to check if a gridlist row already contains the same text how can i do that?? Link to comment
CapY Posted May 10, 2012 Share Posted May 10, 2012 I don't need help with the sliding anymore thanks CapY, I need to know how to check if a gridlist row already contains the same text how can i do that?? Why would you check if there is already an equal row, just clear the gridlist and load the information again. guiGridListClear Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 Because im getting the data for the list from a DB and it creates the row even if its got the same names Link to comment
CapY Posted May 10, 2012 Share Posted May 10, 2012 Because im getting the data for the list from a DB and it creates the row even if its got the same names guiGridListGetItemText An example: if guiGridListGetItemText ( gridlist element, row, column ) == 'yourtext' then -- do stuff ' == ' checks is it equal or not. Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 So how can i loop through each row? Link to comment
Castillo Posted May 10, 2012 Share Posted May 10, 2012 for index, value in ipairs ( yourTable ) do --Code end Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 Thanks Solidsnake i know that but how do i get the rows into a table? Link to comment
Castillo Posted May 10, 2012 Share Posted May 10, 2012 for row = 1, guiGridListGetRowCount ( theGridList ) do -- Code here. end Link to comment
Kenix Posted May 10, 2012 Share Posted May 10, 2012 Thanks Solidsnake i know that but how do i get the rows into a table? Maybe you mean gridlist? Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 Ok that would work but when the gridlist first comes up its empty so i tried doing it like this; addEvent("UpdateLocation",true) function updateLocations(location) local amount = guiGridListGetRowCount ( locationsList ) or 1 for row = 1, amount do if guiGridListGetItemText ( locationsList, row, 1 ) == location then else local row = guiGridListAddRow(locationsList) guiGridListSetItemText ( locationsList, row, 1, location, false, false ) end end end addEventHandler("UpdateLocation", getLocalPlayer(),updateLocations) It doesn't give an error and doesn't show any rows And Kenix i meant how could i make a table out of all the rows in the gridlist Link to comment
Castillo Posted May 10, 2012 Share Posted May 10, 2012 addEvent ( "UpdateLocation", true ) function updateLocations ( location ) local amount = guiGridListGetRowCount ( locationsList ) or 1 for row = 1, amount do if ( guiGridListGetItemText ( locationsList, row, 1 ) ~= location ) then local row = guiGridListAddRow ( locationsList ) guiGridListSetItemText ( locationsList, row, 1, location, false, false ) end end end addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 That still doesn't create any rows, It created them before i added the 3 lines under function but there was copies of the same location in the gridlist. Link to comment
Castillo Posted May 10, 2012 Share Posted May 10, 2012 What is "location" argument? a string? Link to comment
Castillo Posted May 10, 2012 Share Posted May 10, 2012 addEvent ( "UpdateLocation", true ) function updateLocations ( location ) outputChatBox ( type ( location ) ..": ".. tostring ( location ) ) local amount = guiGridListGetRowCount ( locationsList ) or 1 for row = 1, amount do if ( guiGridListGetItemText ( locationsList, row, 1 ) ~= location ) then local row = guiGridListAddRow ( locationsList ) guiGridListSetItemText ( locationsList, row, 1, location, false, false ) end end end addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) Tell me what does it output in the chat. Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 string: LS -- these are the locations i added string: Cheese string: LS But it doesn't show any in the list Link to comment
Axel Posted May 10, 2012 Share Posted May 10, 2012 (edited) maybe here's the problem addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) shouldn't it be like this? addEventHandler ( "UpdateLocation", getRootElement(), updateLocations ) Edited May 10, 2012 by Guest Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 Nah it returns the locations fine mate im trying to see if there is already a row in the gridlist with the same value 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