Results 1 to 1 of 1

Thread: Treeview Long Item Problem

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166

    Treeview Long Item Problem

    Using Windows7.

    I have a treeview where some of the items are within the visible bounds of the treeview (short item).
    Other items are longer and hence the right portion of the string is off the treeview visible area (Long item).

    In the IDE, everything works as designed.
    That is -- a click on a short or long item correctly triggers node_click

    However, when compiled
    The short item works correctly -- nodeclick is triggered
    BUT, the nodeclick event is Not triggered for the long item.
    HOWEVER, if I manually move the scrollbar to the far right, Nodeclick is called as designed for the long item.

    I've attached the NodeClick code, but what's going on is outside of this event IMO.

    Code:
    Private Sub TreeView1_NodeClick(ByVal Node As ComctlLib.Node)
    'VB6 uses ByVal Node As MSComctlLib.Node
    
    'IN TEST
    
    
    frmRolodex.Caption = "NodeClick"
    
       Dim strKey As String
    '   Dim strThisKey As String
      
       '*******
       'STARTUP
       '*******
       Call Textbox_Clear
       strKey = TreeView1.SelectedItem.Key
    
       '*******
       'MAIN
       '*******
       'Root
       If Left$(strKey, 4) = "Root" Then
       
          'Set the Group to save user from Clicking
          'ListIndex needed for DBRecordAdd
          cboGroups.text = TreeView1.SelectedItem.text
          cboGroups.ListIndex = Right$(strKey, Len(strKey) - 4)  '<<CRITICAL Assignment
    
    '      Call Textbox_Clear
          Call SetDefaults      '<<Needed in case user selects EDIT_ADD first
          
          
    '      mlngPrevRootNodeIndex = Node.Index
    
       End If
       
       'Child1 -- Load data from the DB
       If Left$(strKey, 1) = "C" Then
    '      strThisKey = ParseAnyString(strKey, 2, "-")
    
       TreeView1.SelectedItem.EnsureVisible
    
       
    'Test -- 20150430
    'See if will adjust item to right,  again works for short, but not long
    Const WM_HSCROLL = &H114
    Const SB_LINELEFT = 0
    Const SB_PAGELEFT = 2
    Const SB_LINERIGHT = 1
    Const SB_PAGERIGHT = 3
    
    SendMessage TreeView1.hWnd, WM_HSCROLL, SB_PAGERIGHT, ByVal 0&
    
    End Test -- 20150430
          
    '      Call Textbox_Clear
          Call DBRecord_ShowSelected("tblR", CLng(Node.Tag), obBusiness.Value)
          
          'Update Find incase goto lstAlpha
          txtFindLBItem.text = TreeView1.SelectedItem.text
          
       End If
       
       '*******
       'WRAPUP
       '*******
    '   TreeView1.SelectedItem.EnsureVisible
       
    
    End Sub
    Last edited by dw85745; Apr 30th, 2015 at 09:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width