View previous topic :: View next topic |
Author |
Message |
sir-gunny Advanced Cheater
Reputation: 0
Joined: 15 Mar 2012 Posts: 81
|
Posted: Wed Sep 02, 2015 2:53 pm Post subject: ListView: edit cell and change color of a specific row? |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Wed Sep 02, 2015 4:23 pm Post subject: |
|
|
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 |
|
 |
sir-gunny Advanced Cheater
Reputation: 0
Joined: 15 Mar 2012 Posts: 81
|
Posted: Thu Sep 03, 2015 1:14 am Post subject: |
|
|
OK. Thanks
|
|
Back to top |
|
 |
sir-gunny Advanced Cheater
Reputation: 0
Joined: 15 Mar 2012 Posts: 81
|
Posted: Fri Sep 04, 2015 7:41 pm Post subject: |
|
|
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
Greez, gunny
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Sep 04, 2015 7:59 pm Post subject: |
|
|
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 |
|
 |
sir-gunny Advanced Cheater
Reputation: 0
Joined: 15 Mar 2012 Posts: 81
|
Posted: Sat Sep 05, 2015 3:45 am Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Sat Sep 05, 2015 5:08 am Post subject: |
|
|
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 |
|
 |
sir-gunny Advanced Cheater
Reputation: 0
Joined: 15 Mar 2012 Posts: 81
|
Posted: Mon Sep 07, 2015 2:19 pm Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Mon Sep 07, 2015 2:29 pm Post subject: |
|
|
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 |
|
 |
sir-gunny Advanced Cheater
Reputation: 0
Joined: 15 Mar 2012 Posts: 81
|
Posted: Tue Sep 08, 2015 3:06 am Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Tue Sep 08, 2015 3:12 am Post subject: |
|
|
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 |
|
 |
sir-gunny Advanced Cheater
Reputation: 0
Joined: 15 Mar 2012 Posts: 81
|
Posted: Tue Sep 08, 2015 4:31 am Post subject: |
|
|
OK. Thanks!
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Tue Sep 08, 2015 5:10 am Post subject: |
|
|
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 |
|
 |
sir-gunny Advanced Cheater
Reputation: 0
Joined: 15 Mar 2012 Posts: 81
|
Posted: Tue Sep 08, 2015 8:42 am Post subject: |
|
|
Big THX and sorry for this newbie questions!
|
|
Back to top |
|
 |
|