AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

LVX: Row highlighting and cell editing for ListView controls
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
majkinetor



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Fri Jan 11, 2008 6:06 pm    Post subject: Reply with quote

Bugs:

- Enter stops working in the system after edit is shown
- If you enlarge column so horizontal scrollbar is visible, enter will be drawn outside the control, covering the rest of the GUI. The same goes if you scroll so column start is not visible, just on oposite side.
- The font influences edit control:
Code:
Gui, Add, ListView, w250 r8 vLV_Sample gEditLV Grid, Day|Activity
Gui, Font, s14,Courier New

Edit position is correct now.

Suggestions:
1. You should subclass Edit, instead setting hotkyes. That way, user can not have its own ENTER or ESC hotkey, and it may typicaly have in its own GUI.

2. You should subclass ListView, so it monitors arrow keys and ENTER.
On arrow keys, you should make cell selection (will also require you to handle WM_PAINT so if user scroll the view, correct cell will be "highlighted" again on return, but this is just visual, so its not mandatory), so user can move trought the ListView with arrows, and simply press enter to edit the cell.

3. You should make special style of LVX that will make Edit have selected data, or cursor put at the end. Having the cursor at the beginning is nowhere to be found around.

4. Some funny things happen when user is in edit mode and scrolls. Subclass scrolling to fix this.


In any case, subclassing is heavily used with custom controls.
_________________


Last edited by majkinetor on Fri Jan 11, 2008 6:24 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Jero3n



Joined: 19 Jan 2007
Posts: 151

PostPosted: Fri Jan 11, 2008 6:23 pm    Post subject: Reply with quote

Titan, i am using windows xp service pack 2.

P.S So the code is now:

Code:
#Include LVX.ahk

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
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Fri Jan 11, 2008 6:56 pm    Post subject: Reply with quote

majkinetor I had subclassed ListView controls in C# before so I'm aware of the advantages. In addition to what you've mentioned it will also allow me to bind colouring information to each row which I think is very important. I aim to have this by the next major release.

Jero3n try using the #Include at the bottom of the script.
_________________

RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
Jero3n



Joined: 19 Jan 2007
Posts: 151

PostPosted: Fri Jan 11, 2008 6:58 pm    Post subject: Reply with quote

Ya, now it works Smile
But can you explain me why it have to be on the bottom?
Back to top
View user's profile Send private message
bmcclure



Joined: 24 Nov 2007
Posts: 446

PostPosted: Fri Jan 11, 2008 6:59 pm    Post subject: Reply with quote

Cool; I didn't realize about the return value. That should make things simple. Thanks!

Is it possible to have rows in Bold or Italics in a ListView? If so, any chance of this being implemented as an LVX function?
_________________
-Ben

SteamLab
SteamLab Wiki

[Broken] - My industrial music [on GarageBand]
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Fri Jan 11, 2008 7:00 pm    Post subject: Reply with quote

Jero3n wrote:
can you explain me why it have to be on the bottom?
The script has labels and Return commands. This is bad practice on my part; I could've easily put them into a function. The next version will hopefully be a lot different anyway (see above).
_________________

RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Fri Jan 11, 2008 7:09 pm    Post subject: Reply with quote

Quote:
majkinetor I had subclassed ListView controls in C# before so I'm aware of the advantages. In addition to what you've mentioned it will also allow me to bind colouring information to each row which I think is very important. I aim to have this by the next major release.

Good to hear that.

BTW, it may be good time to suggest you to design it in such way so that Edit is not the only option. It would be good to have combobox for instance, or listbox, checkbox etc... You can eventualy let the user specify this the same as color.... New input controls will make a big difference.


You can even make a lil button follow the selection if user creates LVX witch such option, and make it able to run user code on it. Then, you can litteraly display anything with in combination with ComboX.
_________________
Back to top
View user's profile Send private message MSN Messenger
aw1ace



Joined: 14 May 2008
Posts: 6

PostPosted: Wed May 14, 2008 1:47 pm    Post subject: Reply with quote

@Titan

I have been using your LVX and decided to make a few changes and updates, combing what you wrote with Micas Code http://www.autohotkey.com/forum/viewtopic.php?t=19929 for cell editing and evls code http://www.autohotkey.com/forum/viewtopic.php?t=9266 for row colouring in an easy to use set of functions.

I hope you dont mind. I made a few changes and thought I would share. This enabled mouse scroll highlighting as well as single click highlighting for those listviews with no altsubmit.

I am not very good at programming, Yet. I have just started trying out AHK and really enjoying it.

Code:
/* 
    HiLite - Ace
           *Enable onClick Highlighting and Scroll Highlighting
        *Made for the Listviews without altsubmit as there is no "Normal" events fired

      Remarks:
         LV_ColorInitiate("MyListViewVar", HiLite_Color)  - is to be added in your startup to initialize Highlighting
        *Use Color in Hex format, Example Call -  LV_ColorInitiate("MyListViewVar", 0xebf02f)

      Buffer - Set number of lines visible above or below highlighted line while scrolling
        *Default value = 1

      Call MouseDown() and MouseUp() in your WheelUp/WheelDown Hotkeys or whatever you want to make the ListView Scroll with

      -----Do Not need to add but can enhance preformance-----
      -----I used -0x8 because of click+drag ablitiy on my listview----
      #MaxHotkeysPerInterval - Set this or the Scroll hotkeys will trigger Interval Errors
      -0x8 - Add this to listview , will disable Listview highlighting, this is needed if you have g_label for listview and want other events fired
*/

LV_ColorInitiate(LvVar, Color=255, Gui_Number=1, Control="")   {           ; initiatize listview color change procedure, Default HiLite_Color = Blue (255) BGR
  Global
  If LvVar
    LvXVar := LvVar , HiLite_Color := Color                                ; Set Global Variables
  If !Control
    Control = SysListView321
  Gui, %Gui_Number%:+Lastfound
  Gui_ID := WinExist()
  ControlGet, hw_LVX_HiLite, HWND,, %Control%, Ahk_ID %Gui_ID%
  OnMessage( 0x4E, "WM_NOTIFY" )
}

MouseDown(Buffer=1) {
  Global
    DllCall("GetScrollRange", "uint", hw_LVX_HiLite, "int", 1, "int*", min, "int*", max)  ;Used in place of lv_getcount() because it also retrieves minimum range as well as maximum range
    If !ScrollPos                                             ; Set ScrollPos to 1 if empty, this is used inplace of lv_getnext()
      ScrollPos = 1
    If ScrollPos > %max%                                      ; Ensure that LvX function does not draw in row that doest not exist and error out
      Return
    ScrollPos++                                               ; Increment Scrolldown position by 1
    LV_Modify(ScrollPos + Buffer, "+vis")                     ; Add buffer to bottom of highlighted text - Increase "Buffer" to add more lines
    LVX_SetColour(ScrollPos, HiLite_Color)                    ; Highlights current selected row, ScrollPos, Background_Color
Return
}

MouseUp(Buffer=1) {
  Global
    DllCall("GetScrollRange", "uint", hw_LVX_HiLite, "int", 1, "int*", min, "int*", max)  ;Used in place of lv_getcount() because it also retrieves minimum range as well as maximum range
    min+=1                                                    ; Set min = to 1 or LvX function tries to draw on line 0 and errors out
    If ScrollPos < %min% or !ScrollPos                        ; Ensure that LvX function does not draw at row 0 and error
      Return
    ScrollPos--                                               ; DeIncrement Scrolldown position by 1
    LV_Modify(ScrollPos - Buffer, "+vis")                     ; Add buffer to Top of highlighted text - Incraese "Buffer" to add more lines
    LVX_SetColour(ScrollPos, HiLite_Color)                    ; Highlights current selected row, ScrollPos, Background_Color
Return
}

WM_NOTIFY( p_w, p_l, p_m )  {
  Global
  Critical
    Current_Line := NumGet(p_l + 36)+1                                           ; Get Current Selected Row
      If ( DllCall("GetFocus") = hw_LVX_HiLite ) {                               ; Control has Keyboard Focus?
        SendMessage, 4140, Current_Line-1, 2, , Ahk_ID %hw_LVX_HiLite%           ; LVM_GETITEMSTATE
          If ( ErrorLevel = 2 ) {                                                ; LVIS_SELECTED
            NumPut(0x2, p_l + 16)                                                ; LVITEM->stateMask ; LVIS_SELECTED
            SendMessage, 4139, Current_Line-1, p_l, , Ahk_ID %hw_LVX_HiLite%     ; Disable Highlighting
            ScrollPos := Current_Line                                            ; Set Clicked Highlighted line = scrollposition
            LVX_SetColour(Current_Line, HiLite_Color)                            ; Color Current_Line + Background   +Text color is available but not sent in this case
          Return, 0x00000010                                                     ; CDRF_NOTIFYPOSTPAINT
          }
      }
  If (NumGet(p_l + 0) == NumGet(lvx))
    Return, LVX_Notify(p_w, p_l, p_m)
}

/*   Function: LVX_Notify
         Handler for WM_NOTIFY events on ListView controls. Do not use this function.
*/
LVX_Notify(p_w, p_l, p_m) {
   Global lvx
   If (NumGet(p_l + 0) == NumGet(lvx) and NumGet(p_l + 8, 0, "Int") == -12) {
      st := NumGet(p_l + 12)
      If st = 1
         Return, 0x20
      Else If (st == 0x10001) {
         a := NumGet(p_l + 36) * 9 + 9
         If NumGet(lvx, a)
          NumPut(NumGet(lvx, a - 4), p_l + 48), NumPut(NumGet(lvx, a), p_l + 52)
      }
   }
}

/*   Function: LVX_SetColour
         Set the background and/or text colour of a specific row on a ListView control.

      Parameters:
         index - row index (1-based)
         back - (optional) background row colour, must be hex code in RGB format (default: 0xffffff)
         text - (optional) similar to above, except for font colour (default: 0x000000)

      Remarks:
         Sorting will not affect coloured rows.
*/
LVX_SetColour(Index, HiLite=255, Text="") {
   Global lvx, hw_LVX_HiLite
     LVX_SetEditHotkeys()                           ; Enable Default Hotkeys
     SendMessage,4100,0,0, ,Ahk_ID %hw_LVX_HiLite%  ; Get Total Number of rows for highlighting VarCapacity
      VarSetCapacity(lvx, 4 + ErrorLevel * 9, 0)     ; Total rows is needed when capacity is initialized so all rows can be drawn on
     NumPut(hw_LVX_HiLite + 0, lvx)
     A := (Index - 1) * 9 + 5
     If Text
      NumPut(LVX_RevBGR(Text) + 0, lvx, A)
     NumPut(LVX_RevBGR(HiLite) + 0, lvx, A + 4)
     WinSet, Redraw, ,Ahk_ID %hw_LVX_HiLite%
}


/*      Function: LVX_RevBGR
         Helper function for internal use. Converts RGB to BGR.

      Parameters:
         i - BGR hex code
*/
LVX_RevBGR(i) {
   Return, (i & 0xff) << 16 | (i & 0xffff) >> 8 << 8 | i >> 16
}

/*      Function: LVX_SetEditHotkeys
         Change accept/cancel hotkeys in cell editing mode.

      Parameters:
         enter - comma seperated list of hotkey names/modifiers that will save
            the current input text and close editing mode
         esc - same as above but will ignore text entry (i.e. to cancel)

      Remarks:
         The default hotkeys are Enter and Esc (Escape) respectively,
            and such will be used if either parameter is blank or omitted.
*/
LVX_SetEditHotkeys(enter = "Enter,NumpadEnter", esc = "Esc") {
   Global lvx, lvxb
   Static h1, h0
   If (enter == ~1) {
      If esc > 0
      {
         lvxb = 0
         Hotkey, IfWinNotActive, Ahk_ID %esc%
      }
      Loop, Parse, h1, `,
         Hotkey, %A_LoopField%, _lvxb
      Loop, Parse, h0, `,
         Hotkey, %A_LoopField%, _lvxc
      Hotkey, IfWinActive
      Return
   }
   If !enter
      h1 = %enter%
   If !esc
      h0 = %esc%
}

_lvxc: ; these labels are for internal use:
lvxb++
_lvxb:
lvxb++
LVX_SetEditHotkeys(~1, -1)
Return

;----------------------------------------------------------------------------------
;LvX - Titan
; License:
;    o Version 1.04 by Titan <http://www.autohotkey.net/~Titan/#lvx>
;    o zlib License <http://www.autohotkey.net/~Titan/zlib.txt>
; http://www.autohotkey.com/forum/topic26541.html&highlight=lvx

_________________
-Ace


Last edited by aw1ace on Mon May 19, 2008 12:16 pm; edited 2 times in total
Back to top
View user's profile Send private message
jason X
Guest





PostPosted: Sat May 17, 2008 1:03 pm    Post subject: Reply with quote

this is a very useful script! is there a way to set a different font for specific rows?
Back to top
freakkk



Joined: 29 Jul 2005
Posts: 130

PostPosted: Sat May 17, 2008 3:41 pm    Post subject: Reply with quote

aw1ace - Nice job w/ highlighted row coloring! Razz
jason X - You may wanna check out the SpreadSheet control for that (there is also another good example using SpreadSheet in the Properties module..)
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Wed May 21, 2008 3:50 pm    Post subject: Reply with quote

What about using these functions with more than one GUI and more than one ListView?

Can I safely use LVX_Setup(name) infront of LVX_SetColour(). In other words is it a problem calling LVX_Setup multiple times with the same name?
_________________
Tekl
Back to top
View user's profile Send private message Visit poster's website
aw1ace



Joined: 14 May 2008
Posts: 6

PostPosted: Wed May 21, 2008 3:55 pm    Post subject: Reply with quote

@ Tekl

Quote:
What about using these functions with more than one GUI and more than one ListView?


LV_ColorInitiate(LvVar, Color=255, Gui_Number=1, Control="")
-Allows you to specify which GUI and which Control you would like to be highlighted. As long as the WM_Notify is fired than it should be ok.

Quote:
Can I safely use LVX_Setup(name) infront of LVX_SetColour(). In other words is it a problem calling LVX_Setup multiple times with the same name?


You can call LVX_SetColour() as many times as you like, I have tested and have not ran into any problems calling it on multiple lines if you like.

Example:
LVX_SetColour( 1, blue )
LVX_SetColour( 2, red )
LVX_SetColour( 3, purple )
LVX_SetColour( 4, green )

will highlight lines 1-4 in the specified colors.


@ jason X

Quote:
this is a very useful script! is there a way to set a different font for specific rows?


Yes, I left that in from Titan's LVX.
LVX_SetColour(Index, Background, Font) - Font can still be set in the function, I left it out when calling highlighted text.

You would only need to add Font to each LVX_SetColour function call.
_________________
-Ace
Back to top
View user's profile Send private message
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Wed May 21, 2008 4:15 pm    Post subject: Reply with quote

I don't mean LVX_SetColour but LVX_Setup. I just tested it. It is not possible. :.(
_________________
Tekl
Back to top
View user's profile Send private message Visit poster's website
aw1ace



Joined: 14 May 2008
Posts: 6

PostPosted: Wed May 21, 2008 4:23 pm    Post subject: Reply with quote

@ Tekl

I appologize. I thought you were refering to my Original post. I re-wrote some of the module and in my example, there is no LVX_Setup.

I think you may have better results with my Code. There is no need to recall LVX_Setup, just:
Example:
LVX_SetColour( 1, blue )
LVX_SetColour( 2, red )
LVX_SetColour( 3, purple )
LVX_SetColour( 4, green )

If that was what you were going for?

Code:
/*
    HiLite - Ace
           *Enable onClick Highlighting and Scroll Highlighting
        *Made for the Listviews without altsubmit as there is no "Normal" events fired

      Remarks:
         LV_ColorInitiate("MyListViewVar", HiLite_Color)  - is to be added in your startup to initialize Highlighting
        *Use Color in Hex format, Example Call -  LV_ColorInitiate("MyListViewVar", 0xebf02f)

      Buffer - Set number of lines visible above or below highlighted line while scrolling
        *Default value = 1

      Call MouseDown() and MouseUp() in your WheelUp/WheelDown Hotkeys or whatever you want to make the ListView Scroll with

      -----Do Not need to add but can enhance preformance-----
      -----I used -0x8 because of click+drag ablitiy on my listview----
      #MaxHotkeysPerInterval - Set this or the Scroll hotkeys will trigger Interval Errors
      -0x8 - Add this to listview , will disable Listview highlighting, this is needed if you have g_label for listview and want other events fired
*/

LV_ColorInitiate(LvVar, Color=255, Gui_Number=1, Control="")   {           ; initiatize listview color change procedure, Default HiLite_Color = Blue (255) BGR
  Global
  If LvVar
    LvXVar := LvVar , HiLite_Color := Color                                ; Set Global Variables
  If !Control
    Control = SysListView321
  Gui, %Gui_Number%:+Lastfound
  Gui_ID := WinExist()
  ControlGet, hw_LVX_HiLite, HWND,, %Control%, Ahk_ID %Gui_ID%
  OnMessage( 0x4E, "WM_NOTIFY" )
}

MouseDown(Buffer=1) {
  Global
    DllCall("GetScrollRange", "uint", hw_LVX_HiLite, "int", 1, "int*", min, "int*", max)  ;Used in place of lv_getcount() because it also retrieves minimum range as well as maximum range
    If !ScrollPos                                             ; Set ScrollPos to 1 if empty, this is used inplace of lv_getnext()
      ScrollPos = 1
    If ScrollPos > %max%                                      ; Ensure that LvX function does not draw in row that doest not exist and error out
      Return
    ScrollPos++                                               ; Increment Scrolldown position by 1
    LV_Modify(ScrollPos + Buffer, "+vis")                     ; Add buffer to bottom of highlighted text - Increase "Buffer" to add more lines
    LVX_SetColour(ScrollPos, HiLite_Color)                    ; Highlights current selected row, ScrollPos, Background_Color
Return
}

MouseUp(Buffer=1) {
  Global
    DllCall("GetScrollRange", "uint", hw_LVX_HiLite, "int", 1, "int*", min, "int*", max)  ;Used in place of lv_getcount() because it also retrieves minimum range as well as maximum range
    min+=1                                                    ; Set min = to 1 or LvX function tries to draw on line 0 and errors out
    If ScrollPos < %min% or !ScrollPos                        ; Ensure that LvX function does not draw at row 0 and error
      Return
    ScrollPos--                                               ; DeIncrement Scrolldown position by 1
    LV_Modify(ScrollPos - Buffer, "+vis")                     ; Add buffer to Top of highlighted text - Incraese "Buffer" to add more lines
    LVX_SetColour(ScrollPos, HiLite_Color)                    ; Highlights current selected row, ScrollPos, Background_Color
Return
}

WM_NOTIFY( p_w, p_l, p_m )  {
  Global
  Critical
    Current_Line := NumGet(p_l + 36)+1                                           ; Get Current Selected Row
      If ( DllCall("GetFocus") = hw_LVX_HiLite ) {                               ; Control has Keyboard Focus?
        SendMessage, 4140, Current_Line-1, 2, , Ahk_ID %hw_LVX_HiLite%           ; LVM_GETITEMSTATE
          If ( ErrorLevel = 2 ) {                                                ; LVIS_SELECTED
            NumPut(0x2, p_l + 16)                                                ; LVITEM->stateMask ; LVIS_SELECTED
            SendMessage, 4139, Current_Line-1, p_l, , Ahk_ID %hw_LVX_HiLite%     ; Disable Highlighting
            ScrollPos := Current_Line                                            ; Set Clicked Highlighted line = scrollposition
            LVX_SetColour(Current_Line, HiLite_Color)                            ; Color Current_Line + Background   +Text color is available but not sent in this case
          Return, 0x00000010                                                     ; CDRF_NOTIFYPOSTPAINT
          }
      }
  If (NumGet(p_l + 0) == NumGet(lvx))
    Return, LVX_Notify(p_w, p_l, p_m)
}

/*   Function: LVX_Notify
         Handler for WM_NOTIFY events on ListView controls. Do not use this function.
*/
LVX_Notify(p_w, p_l, p_m) {
   Global lvx
   If (NumGet(p_l + 0) == NumGet(lvx) and NumGet(p_l + 8, 0, "Int") == -12) {
      st := NumGet(p_l + 12)
      If st = 1
         Return, 0x20
      Else If (st == 0x10001) {
         a := NumGet(p_l + 36) * 9 + 9
         If NumGet(lvx, a)
          NumPut(NumGet(lvx, a - 4), p_l + 48), NumPut(NumGet(lvx, a), p_l + 52)
      }
   }
}

/*   Function: LVX_SetColour
         Set the background and/or text colour of a specific row on a ListView control.

      Parameters:
         index - row index (1-based)
         back - (optional) background row colour, must be hex code in RGB format (default: 0xffffff)
         text - (optional) similar to above, except for font colour (default: 0x000000)

      Remarks:
         Sorting will not affect coloured rows.
*/
LVX_SetColour(Index, HiLite=255, Text="") {
   Global lvx, hw_LVX_HiLite
     LVX_SetEditHotkeys()                           ; Enable Default Hotkeys
     SendMessage,4100,0,0, ,Ahk_ID %hw_LVX_HiLite%  ; Get Total Number of rows for highlighting VarCapacity
      VarSetCapacity(lvx, 4 + ErrorLevel * 9, 0)     ; Total rows is needed when capacity is initialized so all rows can be drawn on
     NumPut(hw_LVX_HiLite + 0, lvx)
     A := (Index - 1) * 9 + 5
     If Text
      NumPut(LVX_RevBGR(Text) + 0, lvx, A)
     NumPut(LVX_RevBGR(HiLite) + 0, lvx, A + 4)
     WinSet, Redraw, ,Ahk_ID %hw_LVX_HiLite%
}


/*      Function: LVX_RevBGR
         Helper function for internal use. Converts RGB to BGR.

      Parameters:
         i - BGR hex code
*/
LVX_RevBGR(i) {
   Return, (i & 0xff) << 16 | (i & 0xffff) >> 8 << 8 | i >> 16
}

/*      Function: LVX_SetEditHotkeys
         Change accept/cancel hotkeys in cell editing mode.

      Parameters:
         enter - comma seperated list of hotkey names/modifiers that will save
            the current input text and close editing mode
         esc - same as above but will ignore text entry (i.e. to cancel)

      Remarks:
         The default hotkeys are Enter and Esc (Escape) respectively,
            and such will be used if either parameter is blank or omitted.
*/
LVX_SetEditHotkeys(enter = "Enter,NumpadEnter", esc = "Esc") {
   Global lvx, lvxb
   Static h1, h0
   If (enter == ~1) {
      If esc > 0
      {
         lvxb = 0
         Hotkey, IfWinNotActive, Ahk_ID %esc%
      }
      Loop, Parse, h1, `,
         Hotkey, %A_LoopField%, _lvxb
      Loop, Parse, h0, `,
         Hotkey, %A_LoopField%, _lvxc
      Hotkey, IfWinActive
      Return
   }
   If !enter
      h1 = %enter%
   If !esc
      h0 = %esc%
}

_lvxc: ; these labels are for internal use:
lvxb++
_lvxb:
lvxb++
LVX_SetEditHotkeys(~1, -1)
Return

;----------------------------------------------------------------------------------
;LvX - Titan
; License:
;    o Version 1.04 by Titan <http://www.autohotkey.net/~Titan/#lvx>
;    o zlib License <http://www.autohotkey.net/~Titan/zlib.txt>
; http://www.autohotkey.com/forum/topic26541.html&highlight=lvx

_________________
-Ace
Back to top
View user's profile Send private message
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Wed May 21, 2008 5:07 pm    Post subject: Reply with quote

Oh sorry, I haven't tested your Code.

So I have to use LV_ColorInitiate instead of LVX_Setup? Can I call it for the same Control more than one time or how do I specify to wich ListView (I want to use more than one) the LVX_SetColour is send?
_________________
Tekl
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group