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 


Disable:sorting,"moving addresslist items" with lu

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Oct 27, 2012 5:03 pm    Post subject: Disable:sorting,"moving addresslist items" with lu Reply with quote

Edit: moved old stuff at the bottom.

Released:

LUA script that creates a compact CE UI for unprotected cetrainer. It disables "sorting", "moving addresslist items" and hides main menu:

Code:
AddressList = getAddressList()

--Compact mode
  controlMainForm = getMainForm()
  control_setVisible(wincontrol_getControl(controlMainForm,0), false)
  control_setVisible(wincontrol_getControl(controlMainForm,2), false)
  control_setVisible(wincontrol_getControl(controlMainForm,3), false)
--end


--Disable header sorting and dragging
  AddressListTreeview = component_getComponent(AddressList,0)
  AddressListHeader   = component_getComponent(AddressList,1)

  setMethodProperty(AddressListHeader  ,"OnSectionClick",nil)
  setMethodProperty(AddressListTreeview,"OnDragOver"    ,nil)
  setMethodProperty(AddressListTreeview,"OnDragDrop"    ,nil)
  setMethodProperty(AddressListTreeview,"OnEndDrag"     ,nil)
--end

--show main window
  ShowMainWindowTimer = createTimer(nil,false)
  timer_setInterval(ShowMainWindowTimer, 1)
  timer_onTimer(ShowMainWindowTimer, function (sender)
    object_destroy(sender)
    control_setVisible(controlMainForm,true) -- set visible
    form_setMenu(controlMainForm,nil)        -- hide menu
  end)
  timer_setEnabled(ShowMainWindowTimer, true)
--end



############################

Is there any easy way to disable "sorting" and disable "moving addresslist items" inside lua?

That is:
- disable TAddresslist.sectionClick procedure; disable sorting
- disable TAddresslist.DragEnd, TAddresslist.DragOver, TAddresslist.DragDrop procedures; disable draging

Something with wincontrol_getControl, component_findComponentByName, setProperty and setMethodProperty.



It could be handy for "compact-mode cetrainer's".
When we don't want to make "user interface" manually (forms, buttons, etc.)
and we want it somehow user-friendly: without addresslist sorting and draganddrop (moving items)

The end user can't mess memoryrecords order.


The only solution for now is:

-this lua code:
Code:
controlMainForm = getMainForm()
addresslist = component_findComponentByName(controlMainForm,'AddressListTreeview')
setProperty(addresslist,'DragAndDropEnabled','false')
setProperty(addresslist,'SortingEnabled','false')


- and this cheatengine addresslist.pas patch:
http://paste2.org/p/2390822

It adds DragAndDropEnabled and SortingEnabled property
and sets name "AddressListTreeview"

DragAndDropEnabled set to false - disables drag and drop, moving items
SortingEnabled set to false - disables sorting (by description, by address, by type, by value)




BTW
We get compact mode with this code at the beginning:
Code:
controlMainForm = getMainForm()
control_setVisible(wincontrol_getControl(controlMainForm,0), false)
control_setVisible(wincontrol_getControl(controlMainForm,2), false)
control_setVisible(wincontrol_getControl(controlMainForm,3), false)
ShowMainWindowTimer = createTimer(nil,false)
timer_setInterval(ShowMainWindowTimer, 1)
timer_onTimer(ShowMainWindowTimer, function ()
  timer_setEnabled(ShowMainWindowTimer, false)
  object_destroy(ShowMainWindowTimer)
  control_setVisible(controlMainForm,true)
end)
timer_setEnabled(ShowMainWindowTimer, true)

_________________


Last edited by mgr.inz.Player on Fri Jan 18, 2013 11:04 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Sun Oct 28, 2012 3:24 am    Post subject: Reply with quote

The following script will disable the header and the dragging
Code:

al = getAddressList()

for i=0, component_getComponentCount(al)-1 do
  local c=component_getComponent(al,i)
  local cn=object_getClassName(c)
  if cn=='TTreeviewWithScroll' then
    AddressListTreeview=c
  elseif cn=='THeaderControl' then
    AddressListHeader=c
  end
end

--disable the header click
setMethodProperty(AddressListHeader,"OnSectionClick",nil)

--disable the dragging
setMethodProperty(AddressListTreeview,"OnDragOver",nil)
setMethodProperty(AddressListTreeview,"OnDragDrop",nil)
setMethodProperty(AddressListTreeview,"OnEndDrag",nil)

Note though that it can not be returned to normal after this


Also, the following script will get rid of the menu if you wish
Code:

form_setMenu(getMainForm(),nil)
w,h=control_getSize(mf)
control_setSize(mf, w+1,h+1) --forces an update
control_setSize(mf, w-1,h-1)

_________________
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
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Oct 28, 2012 7:53 am    Post subject: Reply with quote

OK, thank you.

I'm using this for unprotected cetrainer:
Code:
AddressList = getAddressList()

--Compact mode
  controlMainForm = getMainForm()
  control_setVisible(wincontrol_getControl(controlMainForm,0), false)
  control_setVisible(wincontrol_getControl(controlMainForm,2), false)
  control_setVisible(wincontrol_getControl(controlMainForm,3), false)
--end


--Disable header sorting and dragging
  AddressListTreeview = component_getComponent(AddressList,0)
  AddressListHeader   = component_getComponent(AddressList,1)

  setMethodProperty(AddressListHeader  ,"OnSectionClick",nil)
  setMethodProperty(AddressListTreeview,"OnDragOver"    ,nil)
  setMethodProperty(AddressListTreeview,"OnDragDrop"    ,nil)
  setMethodProperty(AddressListTreeview,"OnEndDrag"     ,nil)
--end

--show main window
  ShowMainWindowTimer = createTimer(nil,false)
  timer_setInterval(ShowMainWindowTimer, 1)
  timer_onTimer(ShowMainWindowTimer, function (sender)
    object_destroy(sender)
    control_setVisible(controlMainForm,true) -- set visible
    form_setMenu(controlMainForm,nil)        -- hide menu
  end)
  timer_setEnabled(ShowMainWindowTimer, true)
--end

_________________
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