 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Wed Dec 12, 2007 10:11 pm Post subject: LVX: Row highlighting and cell editing for ListView controls |
|
|
This wraps Micas code for cell editing and evls code for row colouring in an easy to use set of functions.
Example (sorry for lack of imagination -_-'):
| Code: | Gui, Add, ListView, w250 r8 vLV_Sample gEditLV Grid, Day|Activity
LV_Add("", "Monday")
LV_Add("", "Tuesday")
LV_Add("", "Wednesday", "pre-set value")
LV_Add("", "Thursday")
LV_Add("", "Friday")
LV_Add("", "Saturday")
LV_Add("", "Sunday")
Loop, 3
LV_ModifyCol(A_Index, "AutoHdr")
LVX_Setup("LV_Sample")
LVX_SetColour(3, 0xce0000, 0xffffff)
LVX_SetColour(2, 0x008000)
LVX_SetColour(5, 0xff8000, 0xffff00)
LVX_SetColour(6, 0xffffff, 0x0000bb)
LVX_SetColour(7, 0xffffff, 0x0000ff)
Gui, Show, , Test
Return
EditLV:
If A_GuiEvent = DoubleClick
LVX_CellEdit()
Return
GuiClose:
ExitApp |
Produces:
Download with instructions _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1091 Location: USA
|
Posted: Wed Dec 12, 2007 10:44 pm Post subject: |
|
|
Very cool....
It is hard to read what is being typed on my pc though:
 _________________
 |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Wed Dec 12, 2007 10:51 pm Post subject: |
|
|
Have you customized your font settings? The edit control is set to match the same dimensions of the cell so you could try increasing font size in your script. _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1091 Location: USA
|
Posted: Wed Dec 12, 2007 11:02 pm Post subject: |
|
|
no font setting changes that i know of. IBM Thinkpad laptop. I made the following changes to my copy of your script:
| Code: | ...
If i
{
Gui, %A_Gui%:Add, Edit, Hwndh ve Hide r1
h += i := 0
}
...
|
| Code: |
...
GuiControl, , e, %t%
GuiControl, Move, e, x%bx% y%by% w%bw% ; h%bh%
GuiControl, Show, e
... |
Last edited by ahklerner on Wed Dec 12, 2007 11:05 pm; edited 1 time in total |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1091 Location: USA
|
Posted: Wed Dec 12, 2007 11:04 pm Post subject: |
|
|
Font changes mess it up, though.
| Code: | Gui, Font, s12
Gui, Add, ListView, w250 r8 vLV_Sample gEditLV Grid, Day|Activity
LV_Add("", "Monday")
LV_Add("", "Tuesday")
LV_Add("", "Wednesday", "pre-set value")
LV_Add("", "Thursday")
LV_Add("", "Friday")
LV_Add("", "Saturday")
LV_Add("", "Sunday")
Loop, 3
LV_ModifyCol(A_Index, "AutoHdr")
Gui, Font, s20
Gui, add, Text, , Blah
LVX_Setup("LV_Sample")
...
|
|
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3592 Location: Belgrade
|
Posted: Wed Dec 12, 2007 11:27 pm Post subject: |
|
|
If i remember correctly about the original code, it may be hard to get it working with RETURN instead clicking.
also, edit appers on wrong place here - 2 rows bellow. _________________
 |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Wed Dec 12, 2007 11:47 pm Post subject: |
|
|
| majkinetor wrote: | | If i remember correctly about the original code, it may be hard to get it working with RETURN instead clicking. | You just need a way to break the loop from a different thread when using a hotkey or have the loop check with GetKeyState() and iterate at high frequency. I'll decide on something for next vers.
| ahklerner wrote: | | Font changes mess it up |
| majkinetor wrote: | | also, edit appers on wrong place here - 2 rows bellow. | Calculating these offsets can be difficult as there are numerous factors that affect the spacing. I'll try fix this too for next time. _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1091 Location: USA
|
Posted: Wed Dec 12, 2007 11:49 pm Post subject: |
|
|
thx  _________________
 |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Dec 13, 2007 7:48 am Post subject: Re: LVX: Row highlighting and cell editing for ListView cont |
|
|
| Titan!: s/colour/color/ |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Thu Dec 13, 2007 9:06 am Post subject: |
|
|
I'll add the archaic spelling as an overload lol.. _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3592 Location: Belgrade
|
Posted: Thu Dec 13, 2007 9:24 am Post subject: |
|
|
| Quote: | | You just need a way to break the loop from a different thread when using a hotkey or have the loop check with GetKeyState() and iterate at high frequency. |
I beleive subclasing is the only real solution. AHK doesn't send return key as event. I recently posted Subclass function and using it u can make it work with Return in few lines of code.
| Quote: | | Calculating these offsets can be difficult as there are numerous factors that affect the spacing. |
Acctually, you can get rectangle of selected item using API, and you can get column width using AHK. _________________
 |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Thu Dec 13, 2007 3:30 pm Post subject: |
|
|
| majkinetor wrote: | | Acctually, you can get rectangle of selected item using API, and you can get column width using AHK. | I get both with API, just for consistency. You said the edit control is positioned wrongly on your comp, could you please give a screenshot?
Uploaded 1.03b which introduces hotkeys. When cell editing press Esc to cancel current input or Enter to save it. You can change these hotkeys with the new function of course. I will try to improve on this so edit mode can be invoked via keyboard navigation on the cells (like Excel). Another improvement I want to add is bounding colouring information to rows, so you can enable sorting on the ListView and still retain highlighting for the corresponding cells. _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3592 Location: Belgrade
|
Posted: Thu Dec 13, 2007 3:47 pm Post subject: |
|
|
On 2 totaly different computers:
About ENTER it was not the problem to make it work when edit is active, but to enter edit state with it. _________________
 |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 968 Location: switzerland
|
Posted: Thu Dec 13, 2007 3:56 pm Post subject: |
|
|
thank you Titan
here a complet example with 1.03b , change functions when Titan changed
example with add and delete button
http://www.autohotkey.net/~garry/LVX_EX_103b.ahk

Last edited by garry on Thu Dec 13, 2007 4:24 pm; edited 1 time in total |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Thu Dec 13, 2007 4:02 pm Post subject: |
|
|
Nice work garry
majkinetor could you please try 1.045b and tell me whether the y-alignment has been corrected or not? _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|