 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
adamrgolf
Joined: 28 Dec 2006 Posts: 384
|
Posted: Thu Jul 03, 2008 9:10 am Post subject: Listview tooltip on mouse hover? |
|
|
is showing of row data in a listview possible by just hovering?
I'm trying to get something to do the following, accept without clicking:
| Code: | #SingleInstance,Force
OnExit,GuiClose
Gui,Add,Listview,vLV gLV AltSubmit,Name|Size
Gui,Show
Loop, %A_WinDir%\*.*
LV_Add("",A_LoopFileName,A_LoopFileSizeKB)
Return
LV:
If A_GuiEvent in Normal
{
LV_GetText(name,A_EventInfo,1)
LV_GetText(size,A_EventInfo,2)
tooltip, Name: %name%%A_Tab%Size: %size%
}
Return
GuiClose:
ExitApp |
Thanks!
Adam |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 384
|
Posted: Wed Jul 09, 2008 10:07 pm Post subject: |
|
|
Anyone have any ideas?  |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6066
|
Posted: Thu Jul 10, 2008 6:18 am Post subject: Re: Listview tooltip on mouse hover? |
|
|
| adamrgolf wrote: | | accept without clicking: |
It not possible, ( I guess ) to get a row text without selecting it first... but a row under mouse can be selected ( without clicking ) if you enable hot-track selection ( LVS_EX_TRACKSELECT LV0x8 ) style for the ListView Control.
This is what I mean:
| Code: | #SingleInstance,Force
OnExit,GuiClose
Gui,Add,Listview,vLV r10 gLV LV0x8 AltSubmit,Name|Size
LV_ModifyCol(1,150 )
Gui,Show
Loop, %A_WinDir%\*.*
LV_Add("",A_LoopFileName,A_LoopFileSizeKB)
Return
LV:
If ( A_GuiEvent="I" )
{
LV_GetText(name,A_EventInfo,1)
LV_GetText(size,A_EventInfo,2)
tooltip, Name: %name%%A_Tab%Size: %size%
SetTimer, ToolTipOff, -2000
}
Return
GuiClose:
ExitApp
ToolTipOff:
Tooltip
Return |
 _________________
 |
|
| Back to top |
|
 |
Micahs
Joined: 01 Dec 2006 Posts: 338
|
Posted: Fri Jul 11, 2008 9:46 am Post subject: |
|
|
Try this. It calcs the row from the mouse pos and displays the text from the first two columns. No Hot-Tracking!
I tweaked parts of my "Listview In-Cell Editing" script.
| Code: | #SingleInstance,Force
OnExit,GuiClose
Gui,Add,Listview, gLV vLV hwndLV_LView AltSubmit,Name|Size
Gui,Show
Loop, %A_WinDir%\*.*
LV_Add("",A_LoopFileName,A_LoopFileSizeKB)
tipDuration = 4000
ControlGetPos, LV_lx, LV_ly, LV_lw, LV_lh, , ahk_id %LV_LView% ;get info on listview
SysGet, SM_CXVSCROLL, 2 ;get width of vertical scrollbar
LVIR_LABEL = 0x0002 ;LVM_GETSUBITEMRECT constant - get label info
LVM_GETITEMCOUNT = 4100 ;gets total number of rows
LVM_SCROLL = 4116 ;scrolls the listview
LVM_GETTOPINDEX = 4135 ;gets the first displayed row
LVM_GETCOUNTPERPAGE = 4136 ;gets number of displayed rows
LVM_GETSUBITEMRECT = 4152 ;gets cell width,height,x,y
OnMessage(0x200, "WM_MOUSEMOVE")
Return
WM_MOUSEMOVE(wParam, lParam, msg, hwnd)
{
global
If(hwnd = LV_LView) ;only if the mouse moved over the listview
{ SendMessage, LVM_GETITEMCOUNT, 0, 0, , ahk_id %LV_LView%
LV_TotalNumOfRows := ErrorLevel ;get total number of rows
SendMessage, LVM_GETCOUNTPERPAGE, 0, 0, , ahk_id %LV_LView%
LV_NumOfRows := ErrorLevel ;get number of displayed rows
SendMessage, LVM_GETTOPINDEX, 0, 0, , ahk_id %LV_LView%
LV_topIndex := ErrorLevel ;get first displayed row
LV_mx := lParam & 0xFFFF ;get mouse x,y
LV_my := lParam >> 16
VarSetCapacity(LV_XYstruct, 16, 0) ;create struct
Loop,% LV_NumOfRows + 1 ;gets the current row and cell Y,H
{ LV_which := LV_topIndex + A_Index - 1 ;loop through each displayed row
NumPut(LVIR_LABEL, LV_XYstruct, 0) ;get label info constant
NumPut(A_Index - 1, LV_XYstruct, 4) ;subitem index
SendMessage, LVM_GETSUBITEMRECT, %LV_which%, &LV_XYstruct, , ahk_id %LV_LView% ;get cell coords
LV_RowY := NumGet(LV_XYstruct,4) ;row upperleft y
LV_RowY2 := NumGet(LV_XYstruct,12) ;row bottomright y2
LV_currColHeight := LV_RowY2 - LV_RowY ;get cell height
If(LV_my <= LV_RowY + LV_currColHeight) ;if mouse Y pos less than row pos + height
{ If(oldLV_which != LV_which)
{ LV_currRow := LV_which + 1 ;1-based current row
LV_currRow0 := LV_which ;0-based current row, if needed
LV_GetText(txt1, LV_currRow, 1)
LV_GetText(txt2, LV_currRow, 2)
ToolTip,Name: %txt1%%A_Tab%Size: %txt2%,,,19
SetTimer, killTip, %tipDuration%
}
oldLV_which := LV_which
Break
killTip:
tooltip,,,, 19
SetTimer, killTip, Off
Return
}
}
}
Else
{ oldLV_which=
tooltip,,,, 19
}
}
LV:
;~ If A_GuiEvent in Normal
;~ {
;~ LV_GetText(name,A_EventInfo,1)
;~ LV_GetText(size,A_EventInfo,2)
;~ tooltip, Name: %name%%A_Tab%Size: %size%
;~ }
Return
GuiClose:
ExitApp |
_________________
 |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 384
|
Posted: Fri Jul 11, 2008 9:49 am Post subject: |
|
|
Holy crap Micahs, that is great!
Edit: This is perfect, exactly what I needed. Great work! |
|
| Back to top |
|
 |
Micahs
Joined: 01 Dec 2006 Posts: 338
|
Posted: Fri Jul 11, 2008 9:55 am Post subject: |
|
|
Glad you like it! Hope it helps. _________________
 |
|
| 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
|