View previous topic :: View next topic |
Author |
Message |
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Sat Sep 11, 2021 1:04 am Post subject: check if a specific item in a checklistbox is checked |
|
|
how do i check if a specific item in a checklistbox is checked or not?
|
|
Back to top |
|
|
Birdi Expert Cheater Reputation: 0
Joined: 08 Jun 2020 Posts: 122 Location: Migrating
|
Posted: Sun Sep 12, 2021 3:31 am Post subject: |
|
|
Check its .State
Code: |
0=Unchecked, 1=Checked, 2=Gray
|
_________________
Trying to learn!
Add me on Discord if you want hands-on help: Birdi#0007 |
|
Back to top |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Sun Sep 12, 2021 5:11 am Post subject: |
|
|
I tried using state before but it just kept giving me an error or nil. Or its that I don't know how to use it, can you give an example?
Description: |
|
Filesize: |
11.68 KB |
Viewed: |
2124 Time(s) |
|
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sun Sep 12, 2021 6:27 am Post subject: |
|
|
Using primitive ways :
Code: | local form = createForm( true );
local checkBoxes = {};
checkBoxes[1] = createCheckBox( form );
checkBoxes[2] = createCheckBox( form );
checkBoxes[3] = createCheckBox( form );
checkBoxes[4] = createCheckBox( form );
checkBoxes[5] = createCheckBox( form );
for x = 1, #checkBoxes do
checkBoxes[x].Caption="This is checkbox " .. tostring( x )
checkBoxes[x].setPosition(10, x * 20)
end
function check_checked()
for x = 1,5 do
if checkBoxes[x].Checked then
print "true"
else
print "false"
end
end
end
checkBoxes[1].onChange =check_checked
checkBoxes[2].onChange =check_checked
checkBoxes[3].onChange =check_checked
checkBoxes[4].onChange =check_checked
checkBoxes[5].onChange =check_checked |
I think same way for check list box
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Thu Sep 16, 2021 4:18 am Post subject: |
|
|
Corroder wrote: | Using primitive ways :
Code: | local form = createForm( true );
local checkBoxes = {};
checkBoxes[1] = createCheckBox( form );
checkBoxes[2] = createCheckBox( form );
checkBoxes[3] = createCheckBox( form );
checkBoxes[4] = createCheckBox( form );
checkBoxes[5] = createCheckBox( form );
for x = 1, #checkBoxes do
checkBoxes[x].Caption="This is checkbox " .. tostring( x )
checkBoxes[x].setPosition(10, x * 20)
end
function check_checked()
for x = 1,5 do
if checkBoxes[x].Checked then
print "true"
else
print "false"
end
end
end
checkBoxes[1].onChange =check_checked
checkBoxes[2].onChange =check_checked
checkBoxes[3].onChange =check_checked
checkBoxes[4].onChange =check_checked
checkBoxes[5].onChange =check_checked |
I think same way for check list box |
is there a way to add scrollbars to this?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Thu Sep 16, 2021 4:54 am Post subject: |
|
|
to answer the first question, use the Selected property
Code: |
for i=0,clb.Items.Count-1
if clb.Selected[i] then
printf("%d is selected", i)
end
|
_________________
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
Last edited by Dark Byte on Thu Sep 16, 2021 7:14 am; edited 1 time in total |
|
Back to top |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Thu Sep 16, 2021 6:30 am Post subject: |
|
|
Dark Byte wrote: | to answer the first question, use the Selected property
Code: |
for i=0,clb.Items.Count
if clb.Selected[i] then
printf("%d is selected", i)
end
|
|
Thank you so much DB!, I finally got it working.
|
|
Back to top |
|
|
|