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 to set colum width?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jul 18, 2013 6:34 am    Post subject: How to set colum width? Reply with quote

hey,
Im facing another problem, this time with listview.
Im incapable to set the colum width.

I've this great,
Code:
   self.FormLv = createListView(self.MainForm)
   setProperty(self.FormLv, 'ViewStyle', 'vsReport')
   setProperty(self.FormLv, 'RowSelect', 'True')
   setProperty(self.FormLv, 'ReadOnly', 'True')
   self.FormLv.height = self._lvheight
   self.FormLv.width = self._lvwidth
   self.FormLvC = self.FormLv.getColumns()
   self.FormLvColum1 = self.FormLvC.add()
   self.FormLvColum2 = self.FormLvC.add()
   self.FormLvColum1.Caption = self._lvc1caption
   self.FormLvColum2.Caption = self._lvc2caption

But doing
Code:
   self.FormLvColum1.Width = self._lvculomwidth
   self.FormLvColum2.Width = self._lvculomwidth

or
Code:
   self.FormLvColum1.MinWidth = self._lvculomwidth
   self.FormLvColum2.MinWidth = self._lvculomwidth
   self.FormLvColum1.MaxWidth = self._lvculomwidth
   self.FormLvColum2.MaxWidth = self._lvculomwidth

or even trying to get the width
Code:
   self.FormLvColum1.getWidth()
   self.FormLvColum2.getWidth()

When I call the getWidth() function it returns me this
Code:
attempt to call field 'getWidth' (a nil value)
Script Error


Am I doing something wrong?

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Jul 18, 2013 9:19 am    Post subject: Reply with quote

Oops, looks like I messed up the method names for column
I accidentally left them to listcolumn_getWidth (do NOT use this, I will change it to getWidth next version)
Luckily the Properties do work (Which are recommended over the methods anyhow)

Also .Width= does work

e.g:
Code:

self.FormLvColum1.Width=100

does work for me (it sets it to 100 width)

tested with this code works as well:
Code:

self={}
self.MainForm=createForm(true)
self._lvculomnwidth=100

   self.FormLv = createListView(self.MainForm)
   setProperty(self.FormLv, 'ViewStyle', 'vsReport')
   setProperty(self.FormLv, 'RowSelect', 'True')
   setProperty(self.FormLv, 'ReadOnly', 'True')
   self.FormLv.height = 200
   self.FormLv.width = 300
   self.FormLvC = self.FormLv.getColumns()
   self.FormLvColum1 = self.FormLvC.add()
   self.FormLvColum2 = self.FormLvC.add()
   self.FormLvColum1.Caption = self._lvc1caption
   self.FormLvColum2.Caption = self._lvc2caption

   self.FormLvColum1.Width=self._lvculomnwidth
   self.FormLvColum2.Width=self._lvculomnwidth


note that I initialized self._lvculomnwidth NOT self._lvcolumnwidth...

_________________
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
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jul 18, 2013 10:34 am    Post subject: Reply with quote

Cant double post so I deleted the post and re-post.
How can I add an item to the list view?
I'm doing this:


Code:

function EasyFormAccess:Start()
--..
   self.FormLvI = self.FormLv.getItems()
--....
end
function EasyFormAccess:AddItems(FormCaption)
   local Temp
   Temp = self.FormLvI.add()
   Temp.caption = FormCaption
end

function EasyFormAccess:Initialize()
   for i = 1,#GlobalFormTable do
      self:AddItems(GlobalFormTable[i].caption)
   end
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Jul 18, 2013 10:40 am    Post subject: Reply with quote

use Caption instead of caption
_________________
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
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jul 18, 2013 10:43 am    Post subject: Reply with quote

The caption is not the problem.
It just won't create any 'item' in the listview.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Jul 18, 2013 11:11 am    Post subject: Reply with quote

You're sure it doesn't add an item?

this works
Code:


self={}
self.MainForm=createForm(true)
self._lvculomnwidth=100

   self.FormLv = createListView(self.MainForm)
   setProperty(self.FormLv, 'ViewStyle', 'vsReport')
   setProperty(self.FormLv, 'RowSelect', 'True')
   setProperty(self.FormLv, 'ReadOnly', 'True')
   self.FormLv.height = 200
   self.FormLv.width = 300
   self.FormLvC = self.FormLv.getColumns()
   self.FormLvColum1 = self.FormLvC.add()
   self.FormLvColum2 = self.FormLvC.add()
   self.FormLvColum1.Caption = self._lvc1caption
   self.FormLvColum2.Caption = self._lvc2caption

   self.FormLvColum1.Width=self._lvculomnwidth
   self.FormLvColum2.Width=self._lvculomnwidth

   self.FormLvI=self.FormLv.getItems()

   x=self.FormLvI.add()
   x.Caption="bla"
 


pehaps #GlobalFormTable returns 0

_________________
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
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jul 18, 2013 12:05 pm    Post subject: Reply with quote

Oh sorry, I found my issue.
Setting OnClick function works ONLY if I use it as self.function, while the original function is self:function.

(Self = table name).
To get around it, just made a new function for these buttons who call the self:function()...

Anyway, everything works great, almost finished.
Just last question.
How can I show a form based the ListView index.
I mean, I can show/hide easily with ListBox,
But in ListView, the index resets back to -1 when it loses focus.
How can I keep the index the way it is without allow it to reset? (Like in listbox)

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Jul 18, 2013 12:53 pm    Post subject: Reply with quote

Are you sure the index resets to -1 or just becomes invisible (index value stays)

anyhow, assuming you mean invisible , set the property "HideSelection" to false (default is true)

_________________
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
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jul 18, 2013 1:47 pm    Post subject: Reply with quote

Thank you very much!
Almost finished.

Edit:
Thanks mate, finished it.
http://forum.cheatengine.org/viewtopic.php?t=566519

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
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