Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - command bar FindControl keeps returning the same
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

command bar FindControl keeps returning the same

 Post Reply Post Reply
Author
Message
paulhaggo View Drop Down
Groupie
Groupie


Joined: 21 June 2018
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote paulhaggo Quote  Post ReplyReply Direct Link To This Post Topic: command bar FindControl keeps returning the same
    Posted: 03 December 2018 at 5:04am
Hello

I am trying to loop the menu to find captions of sub menu items

I did email support 4 days ago, no answer Yet again, the extra paid support is awful

The basic idea here, is a function, which i supply a button id and it puts the child button captions in a listbox

I know the code works because If i use it once, it works.. and if i close the exe and try a different button, it returns the new correct buttons values

However, if I press around the buttons without restarting the exe, i always get the same data back

So it appears to be caching, does anyone know how to clear the find function, the nothing vb method do not seem to work

My code is below, thank you

Public Sub FillReportsListBox(strParentButtonName As String)

Dim cbcTemp As CommandBarControl
   
Set cbcTemp = frmMain.CJMenuPopUp.FindControl(xtpControlButton, strParentButtonName, True, False)

Debug.Print cbcTemp.ID
lvwReports.ClearList

    Dim intx As Integer
        intx = 1
    Dim lngItem As Long
    
    While (intx < cbcTemp.Controls.Count)
        
           lngItem = lvwReports.AddItem(cbcTemp.Controls(intx).Caption)
   
        intx = intx + 1
    Wend

Set cbcTemp = Nothing

End Sub


Back to Top
paulhaggo View Drop Down
Groupie
Groupie


Joined: 21 June 2018
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote paulhaggo Quote  Post ReplyReply Direct Link To This Post Posted: 05 December 2018 at 5:10am
I got this working in the end, incase anyone ever needs it


vb6 

CJMenuPopUp = name of my CommandBars object
ID_REPORTS_CLIENTS = a long (name happened to match the button ID, its a long which equals the ID in the button xml > designed > export xml)

Public Sub FillReportsListBox()

Dim cbcTemp As CommandBarControl

Set cbcTemp = frmMain.CJMenuPopUp.FindControl(xtpControlPopup, ID_REPORTS_CLIENTS, True, True)

Dim intx As Integer
    intx = 1

While (intx < cbcTemp.CommandBar.Controls.Count)
  
   Debug.Print cbcTemp.CommandBar.Controls(intx).Caption
   intx = intx + 1

Wend
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.094 seconds.