i cant seem to get what you mean, can you clarify more
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved" option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
I'm sure Joacim Andersson's solution may be ok...but I adapted it for vhGrid. The only issue is the Column headers get mixed-up and cann't refresh.
Code:
EDIT::
'vhGrid
'virtual listview
Public Sub CellEnsureVisible(ByVal SubColumn As Long)
Dim tRClt As RECT
Dim tRect As RECT
Dim iX As Long
'Only do the horizontal scrolling if we are in grid or report view
GetClientRect m_lHGHwnd, tRClt
CellCalcRect RowInFocus, SubColumn, tRect
With tRect
If .Right > tRClt.Right Then iX = (.Right - tRClt.Right)
If .left < tRClt.left Then iX = (.left - tRClt.left)
Call SendMessageLongA(m_lHGHwnd, LVM_SCROLL, iX, ByVal 0) 'Now scroll to the right or left
End With
End Sub::
LucasMKG
getting to the innards of listview
Last edited by LucasMKG; Jan 27th, 2016 at 06:21 AM.
What do you mean the column headers get mixed up? Something there is rearranging column order? There's always HDM_ORDERTOINDEX, but I've never needed it even refreshing columns after rearranging their order.
When I move to the right/left the control behaves correctly but the column header is static
- when I remove HDM_LAYOUT in myWndProc (GXISubclass_WndProc) it behaves correctly...it might have to do with the WINDOWPOS flags
RESOLVED
EDIT::
Code:
'MyWndProc (GXISubclass_WndProc)
Case HDM_LAYOUT
If Not m_bHeaderHide Then
'/! hey m$, where's the f***ing documentation?
CopyMemory tHDL, ByVal lParam, Len(tHDL)
CopyMemory tWPos, ByVal tHDL.lpwpos, Len(tWPos)
CopyMemory tRect, ByVal tHDL.lprc, Len(tRect)
'/* setwinpos struct
With tWPos
.hWnd = m_lHdrHwnd
.hWndInsertAfter = 0&
.cx = (tRect.Right - tRect.left)
.cy = m_lHeaderHeight
.x = tRect.left
.y = 0&
'rem.Seal .flags = SWP_NOACTIVATE Or SWP_NOZORDER Or SWP_NOMOVE
.flags = SWP_NOACTIVATE Or SWP_NOZORDER
End With
'/* adjust client rect
tRect.top = m_lHeaderHeight + 2
'/* copy and forward
CopyMemory ByVal tHDL.lprc, tRect, Len(tRect)
CopyMemory ByVal tHDL.lpwpos, tWPos, Len(tWPos)
CopyMemory ByVal lParam, tHDL, Len(tHDL)
' lReturn = lParam
bHandled = True
End If
- 'SWP_NOMOVE' :: was he culprit...for causing Header not to scroll.
Thanks fafalone for ensuring that I'm always sorted.
LucasMKG
hala to VBForums moderators
Last edited by LucasMKG; Jan 27th, 2016 at 08:38 AM.