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 


ListView: edit cell and change color of a specific row?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 81

PostPosted: Wed Sep 02, 2015 2:53 pm    Post subject: ListView: edit cell and change color of a specific row? Reply with quote

Hi.

How can i edit a cell in a LV? If I use readonly = false, i only can edit a cell at the first column.

Is it possible to change the bg an font color from a spec row?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Sep 02, 2015 4:23 pm    Post subject: Reply with quote

For a listview cell editing isn't possible. You might be able to use the mousedown event to spawn an EditBox without border at the cell location and edit it when the editbox loses focus, but it's never going to look good

as for color in a row, not possible either. The ownerDraw property isn't implemented, which is what you need to draw your own listview.

_________________
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
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 81

PostPosted: Thu Sep 03, 2015 1:14 am    Post subject: Reply with quote

OK. Thanks Smile
Back to top
View user's profile Send private message
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 81

PostPosted: Fri Sep 04, 2015 7:41 pm    Post subject: Reply with quote

Hi.

To edit cells, i use a dialog like your "Change Description"-Dlg. My Problem is to get the count of columns and the currently selected/clicked column in my LV.

To get the current clicked column, i create this function:
Code:
function CEListView1MouseUp(sender, button, x, y)
 local CordsTemp, ColumnTemp = 0, 0
 local ColCount = 3
 repeat
     if sender.Columns[ColumnTemp].Visible == true then
        CordsTemp = CordsTemp + sender.Columns[ColumnTemp].Width
        ColumnTemp = CordsTemp >= x and ColumnTemp or ColumnTemp + 1
     end
     ColumnTemp = ColumnTemp <= ColCount -1 and ColumnTemp or -1
 until CordsTemp >= x or ColumnTemp == -1
 GlobalLVColumn = ColumnTemp
end


But i think someone knows a easier way to get the column.count and clicked column.

Some more question about your "Change Description"-Dlg. If this dlg is visible i can't klick no other CE form. How can i get this option to my dlg?

I hope someon can help me Smile

Greez, gunny Smile
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Sep 04, 2015 7:59 pm    Post subject: Reply with quote

Use the OnSelectItem event?
Code:
function CEListView1SelectItem(sender, listitem, selected)
  if selected then
    print(listitem.Caption .. " selected")
  else
    print(listitem.Caption .. " unselected")
  end
end
Back to top
View user's profile Send private message
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 81

PostPosted: Sat Sep 05, 2015 3:45 am    Post subject: Reply with quote

Hi.

Thank you for your answare.

SelectItem gives only the Items (the row). To edit the SubItems i need the selected /clicked column...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sat Sep 05, 2015 5:08 am    Post subject: This post has 1 review(s) Reply with quote

Ok, there is an issue with the Columns.Count property (getCount() as well) so you'll have to know the number of columns yourself (You should know that as you created the list and columns, or at least should be able to track it)

fixed in git, when it works: ListView.Columns.Count contains the number of columns


Here's an implementation I use.
Code:


columncount=3
function CEListView1MouseDown(sender, button, x, y)
  local i
  local xpos=0;

  for i=0, columncount-1 do
    if UDF1.CEListView1.Columns[i].Visible then

      local start=xpos;
      local stop=xpos+UDF1.CEListView1.Columns[i].Width


      if (x>=start) and (x<stop) then
        print("clicked on column "..i)
        break
      end

      xpos=stop
    end
  end
end



As for the change description dialog:
You could use InputQuery
Code:

return inputQuery("This is the header", "Ask questions here", "leave empty or fill in the original value or whatever")


Or if you do use your own form, then instead of doing formname.show() do formname.showModal()

_________________
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
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 81

PostPosted: Mon Sep 07, 2015 2:19 pm    Post subject: Reply with quote

Hi. It works grate.Thanks.

But one small question: if i use showModal and close the form, the other ce forms stay disabeld... how can i active them?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Sep 07, 2015 2:29 pm    Post subject: Reply with quote

I'm not sure what you mean with disabled forms.

Once the modal form has closed, all other enabled and visible forms that where shown before showmodal, should become enabled again

_________________
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
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 81

PostPosted: Tue Sep 08, 2015 3:06 am    Post subject: Reply with quote

Hi.

Sorry for my vague question.

I mean with "the other ce forms stay disabled", i can't click to a form anymore and close ce is only possible with the Task-Manager.

Here a example:

Code:
function CreateMyForms()
 UDF1 = createForm(false)
 UDF1.caption = "UDF1"
 UDF1.width = 320
 UDF1.height = 240
 UDF1.align = "alNone"
 UDF1.BorderIcons = "[biSystemMenu,biMinimize,biMaximize]"
 UDF1.BorderStyle = "bsSizeable"
 UDF1.Icon = nil
 UDF1.Position = "poDesktopCenter"
 UDF1.ShowInTaskBar = "stDefault"
 UDF1.WindowState = "wsNormal"
 local FormX, FormY = UDF1.getPosition()
 print("Left: "..UDF1.Left,"Top: "..UDF1.Top,"X/Y: "..FormX, FormY,"Left: "..UDF1.getLeft(),"Top: "..UDF1.getTop())


 CEButton1 = createButton(UDF1)
 CEButton1.caption = "CEButton1"
 CEButton1.left = 63
 CEButton1.top = 118
 CEButton1.width = 75
 CEButton1.height = 25
 CEButton1.align = "alNone"
 CEButton1.enabled = true
 CEButton1.visible = true

 UDF2 = createForm(false)
 UDF2.caption = "UDF2"
 UDF2.align = "alNone"
 UDF2.BorderIcons = "[biSystemMenu,biMinimize,biMaximize]"
 UDF2.BorderStyle = "bsSizeable"
 UDF2.Icon = nil
 UDF2.Position = "poDesktopCenter"
 UDF2.ShowInTaskBar = "stDefault"
 UDF2.WindowState = "wsNormal"

 CEButton2 = createButton(UDF2)
 CEButton2.caption = "CEButton2"
 CEButton2.left = 50
 CEButton2.top = 50
 CEButton2.width = 247
 CEButton2.height = 77
 CEButton2.align = "alNone"
 CEButton2.enabled = true
 CEButton2.visible = true

 CEButton1.onClick = fButton1Click
 CEButton2.onClick = fButton2Click
 UDF2.onClose = fButton2Click

 UDF1.show()
end

function fButton1Click()
-- UDF2.show()
 UDF2.showModal()
end

function fButton2Click()
 UDF2.hide()
 return caHide
end

CreateMyForms()


By the Way: How can i get the position from my form if i use "UDF1.Position = "poDesktopCenter""?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Sep 08, 2015 3:12 am    Post subject: Reply with quote

hiding a form isn't completely the same as closing it.
replace UDF2.hide() with UDF2.close()

alternatively, assigning a value to UDF2.ModalResult will close it as well (it will be the reeult of showModal

_________________
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
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 81

PostPosted: Tue Sep 08, 2015 4:31 am    Post subject: Reply with quote

Idea OK. Thanks! Smile

In my example i use "UDF1.Position = "poDesktopCenter"" to center it. How can i get the position of the form? If i use UDF1.Left, UDF1.Top,UDF1.getPosition(),UDF1.getLeft(),UDF1.getTop i get always 0. I need the center position to create the UDF2 on the right side at UDF1 (like UDF2.Left = UDF1.Left + UDF1.Width...)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Sep 08, 2015 5:10 am    Post subject: Reply with quote

You need to show the form before things like Position take effect
_________________
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
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 81

PostPosted: Tue Sep 08, 2015 8:42 am    Post subject: Reply with quote

Idea Idea Big THX and sorry for this newbie questions! Smile Embarassed Laughing
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