View previous topic :: View next topic |
Author |
Message |
Razi Expert Cheater Reputation: 1
Joined: 17 Jan 2018 Posts: 202
|
Posted: Mon Feb 26, 2024 10:43 am Post subject: Edit box in listview with vertical scroll bar |
|
|
I have a question about listview with vertical scroll bar. How to get row number by clicking on the listview SubItems, if listview.RowSelect = false?
How to place the Edit box in the right place in the listview, if listview has a vertical scroll bar? Because after we move the scrollbar, the location of the Edit box should change accordingly after we click on the listview again.
Example: listview with 60 rows and 16 columns. ListView displays 60*16=960 1-byte values. (CEListView1 ViewStyle = vsReport; CEEdit1 BorderStyle = bsNone)
This code works if listview.RowSelect = true :
Code: | UDF1_CEListView1.OnMouseDown = function(sender, button, x, y)
local i
local xpos=0;
local edit = UDF1_CEEdit1
for i=0, sender.Columns.Count-1 do
if sender.Columns[i].Visible then
local start=xpos;
local stop=xpos+sender.Columns[i].Width
if (x>=start) and (x<stop) then
--print("clicked on column "..i)
local Ind=sender.ItemIndex
edit.Visible = true
if i == 0 then --if 1-st column clicked
edit.Text = sender.Items[Ind].Caption
else
edit.Text = sender.Items[Ind].SubItems[i-1]
end
edit.Tag = Ind*0x10+i --0x10 = row
break
end
xpos=stop
end
end
if sender.ItemIndex ~= -1 then
edit.Left = sender.Left+3+xpos
edit.Top = sender.ItemIndex*14+sender.Top+22
end
end
UDF1_CEButton1.OnClick = function(sender)
local items = UDF1_CEListView1.Items
for x = 0, 59 do
local offset = 0x9CEF7C+x*0x10
local item = items[x]
item.Caption = readBytes(offset)
for y = 0, 14 do
local val = readBytes(offset+1+y)
item.SubItems[y] = val
end
end
end |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 459
Joined: 09 May 2003 Posts: 25319 Location: The netherlands
|
Posted: Tue Feb 27, 2024 12:42 am Post subject: |
|
|
listview.TopItem is the item at top, use that to calculate the rest
_________________
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 |
|
|
Razi Expert Cheater Reputation: 1
Joined: 17 Jan 2018 Posts: 202
|
Posted: Tue Feb 27, 2024 3:40 am Post subject: |
|
|
Dark Byte wrote: | listview.TopItem is the item at top, use that to calculate the rest |
Thanks, it works. This calculation is used in the code:
Code: | edit.Top = (sender.ItemIndex-sender.TopItem.Index)*14+sender.Top+22
|
|
|
Back to top |
|
|
|