Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How do I access checkboxes in listviews

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
gyan1010
Newbie cheater
Reputation: 0

Joined: 22 Oct 2007
Posts: 23

PostPosted: Sat Jan 28, 2012 12:19 am    Post subject: How do I access checkboxes in listviews Reply with quote

From the form designer I noticed I could add Checkboxes in ListViews and decided to try it for my lua script.

I was able to add them buy setting the property
Code:
setProperty(lv, 'Checkboxes', 'True')


But now that I have items, how do I access the state of each check box?

I've tried using getPropertyList on one of the items to see if it somewhere in there but get access violations.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25281
Location: The netherlands

PostPosted: Sat Jan 28, 2012 10:53 am    Post subject: Reply with quote

the "checked" property is part of the ListItem class

try this: untested
Code:

lvi=listitems_getItem(lv, indextolookup)
getProperty(lvi, "Checked")

_________________
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
View user's profile Send private message MSN Messenger
gyan1010
Newbie cheater
Reputation: 0

Joined: 22 Oct 2007
Posts: 23

PostPosted: Sat Jan 28, 2012 11:23 am    Post subject: Reply with quote

Thanks for the reply, that doesn't work though.

I cannot get listitems_getItem to return the item, it is not documented in help btw.

But I also tried getting this property using the return value from listitems_add which should return the ListItem class as well. Yet it says checked it not a property of that.

Here is my whole code so far along with a test for that line.

Code:
-- Form
f=createForm()
control_setSize(f,300,400)
setProperty(f, 'BorderStyle', 'bsDialog')

-- List View
lv = createListView(f)
control_setSize(lv,280,380)
control_setPosition(lv,10,10)
setProperty(lv, 'ViewStyle', 'vsReport')
setProperty(lv, 'Checkboxes', 'True')
setProperty(lv, 'ReadOnly', 'True')

-- Columns
lvc=listview_getColumns(lv)
c1=listcolumns_add(lvc)
listcolumn_setCaption(c1, 'Hacks')
setProperty(c1, 'AutoSize', 'True')

-- Rows
lvis=listview_getItems(lv)

-- addHack Function
hacks = {}
function addHack(name,search,replace,initialOffset)
   i = #hacks + 1
   hacks[i] =
   {
      -- Variables
      search = search,
      replace = replace,
      initialOffset = initialOffset or 0,

      -- Control Objects
      _item = listitems_add(lvis)
   }
   listitem_setCaption(hacks[i]._item, name)
end

-- Test Data
addHack("Test Hack 1","","")
addHack("Test Hack 2","","",4)
addHack("Test Hack 3","","")

-- Testing
--print(getProperty(hacks[1]._item, "Checked"))

lvi=listitems_getItem(lvis, 1)
print(getProperty(lvi, "Checked"))
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25281
Location: The netherlands

PostPosted: Sat Jan 28, 2012 11:46 am    Post subject: Reply with quote

sorry, listitems_getItem is a 6.2+ function, forgot that.

Also, seems like checked isn't a published property, so get/setProperty wouldn't work anyhow


Just wait till 6.2 if you need to use the undocumented "Checkbox" function, it's implemented there

_________________
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
View user's profile Send private message MSN Messenger
gyan1010
Newbie cheater
Reputation: 0

Joined: 22 Oct 2007
Posts: 23

PostPosted: Sat Jan 28, 2012 12:53 pm    Post subject: Reply with quote

Ok Thanks again!

Don't suppose there is any use asking for a beta version to play with is there?
Back to top
View user's profile Send private message
gyan1010
Newbie cheater
Reputation: 0

Joined: 22 Oct 2007
Posts: 23

PostPosted: Sun Jan 29, 2012 12:10 am    Post subject: Reply with quote

I'd also like to be able to perform other actions like color changing on the individual items in the listview. It seems that although they are indeed control objects, making them different than listboxes, we are locked out of accessing their properties.

Is this also something that will be changed in 6.2?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25281
Location: The netherlands

PostPosted: Sun Jan 29, 2012 2:35 am    Post subject: Reply with quote

With the subitems you can add other columns (but that's already possible in 6.1)

Color though is something not implemented for 6.2 (Color isn't part of a listitem, or even listview. You draw it yourself at the position where the item is...)
perhaps 6.3

_________________
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
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites