 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Sat May 04, 2013 7:22 am Post subject: Question |
|
|
Is it possible to change string for specific item in ListBox?
Let's say I got 5 items in my ListBox,
I want the first one to be Red, the second one to be Blue, the third one to be Green, the forth one to be Yellow and the fifth one to be Orange.
How can i do it?
Description: |
|
Filesize: |
17 KB |
Viewed: |
2582 Time(s) |

|
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Sat May 04, 2013 7:39 am Post subject: |
|
|
Get the Items object of the listbox
Items is an inherited object of Strings, so you can then use strings_setString(list, index, text)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Sat May 04, 2013 7:44 am Post subject: |
|
|
Oh crap,
I forgot to write one important word at the question.
Heres the real question.
Flash hacker wrote: | Is it possible to change string color for specific item in ListBox?
Let's say I got 5 items in my ListBox,
I want the first one to be Red, the second one to be Blue, the third one to be Green, the forth one to be Yellow and the fifth one to be Orange.
How can i do it? |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sat May 04, 2013 7:49 am Post subject: |
|
|
You can edit them like this:
Code: | function replaceString( l, f, r )
local s = listbox_getItems( l );
for x = 0, strings_getCount( s ) - 1 do
local str = strings_getString( s, x );
if (str == f) then
strings_setString( s, x, r );
return true;
end
end
return false;
end |
Full example:
Code: |
local f = createForm( true );
local l = createListBox( f );
-- Add items to listbox..
local s = listbox_getItems( l );
strings_add( s, 'Entry 1' );
strings_add( s, 'Entry 2' );
strings_add( s, 'Entry 3' );
strings_add( s, 'Entry 4' );
-- Replacement function..
function replaceString( l, f, r )
local s = listbox_getItems( l );
for x = 0, strings_getCount( s ) - 1 do
local str = strings_getString( s, x );
if (str == f) then
strings_setString( s, x, r );
return true;
end
end
return false;
end
-- Replace entry 3 with derp..
replaceString( l, 'Entry 3', 'derp' );
|
_________________
- Retired. |
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Mon May 06, 2013 1:11 pm Post subject: |
|
|
Flash hacker wrote: | Oh crap,
I forgot to write one important word at the question.
Heres the real question.
Flash hacker wrote: | Is it possible to change string color for specific item in ListBox?
Let's say I got 5 items in my ListBox,
I want the first one to be Red, the second one to be Blue, the third one to be Green, the forth one to be Yellow and the fifth one to be Orange.
How can i do it? |
|
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|