Print Page | Close Window

multiple static levels.. then dynamic

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=16064
Printed Date: 14 July 2025 at 1:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: multiple static levels.. then dynamic
Posted By: wxperson
Subject: multiple static levels.. then dynamic
Date Posted: 24 January 2010 at 3:20pm
I am confused on how to create a menu with 2 static levels and dynamic levels beneath them. The tooltipcontext example did not quite fit because I have several static levels and then a dynamic one...

The image below shows OFFICIAL FORECAST, and TRACK WITH AVERAGE ERROR as 2 static levels and then the dynamic level beneath TRACK WITH AVERAGE ERROR which is the list of dates/times.




I have done some prototype (toolbar) code and managed to get to the first level (see image at bottom of post ). The following code is in the form.load event.

With ToolBar1.Controls
    Set Control = .Add(xtpControlSplitButtonPopup, 110, "Plot")
    Control.CommandBar.Controls.Add xtpControlButton, 120, "Track"
    Control.CommandBar.Controls.Add xtpControlPopup, 130, "Official Forecast"
    Control.CommandBar.Controls.Add xtpControlButton, 140, "Model"
    Control.CommandBar.Controls.Add xtpControlPopup, 150, "Climate Forecast"
    Control.CommandBar.Controls.Add xtpControlPopup, 160, "Past Storm Tracks"
End With

Where I am stuck is how do I create the static levels beneath Official Forecast.. TRACK ONLY, TRACK WITH AVERAGE ERROR and AVERAGE ERROR ONLY?

It makes sense to me to put the definition of the next static level into the form load event and not the initcommandspopup event. I would assume the dynamic dates/times would go into that event.

The solution may be staring me in the face but I am not seeing it yet. Any help would be appreciated.

Thanks,

George






Replies:
Posted By: SuperMario
Date Posted: 25 January 2010 at 10:17am


Const ID_PLOT_PLOT = 150
Const ID_PLOT_TRACK = 151
Const ID_PLOT_OFFICIAL_FORECAST = 152
Const ID_PLOT_MODEL = 153
Const ID_PLOT_CLIMATE_FORECAST = 154
Const ID_PLOT_PAST_STORM_TRACKS = 155

Const OFFICIAL_FORECAST_OFFSET = 5000
Const CLIMATE_FORECAST_OFFSET = 6000
Const PAST_STORM_TRACKS_OFFSET = 7000


Private Sub CommandBars_InitCommandsPopup(ByVal CommandBar As XtremeCommandBars.ICommandBar)

Dim Control As CommandBarControl
Dim Count As Integer
Dim nPos As Integer

If Not CommandBar.Parent Is Nothing Then

 '*********************Displays ID_PLOT_OFFICIAL_FORECAST folder
 If CommandBar.Parent.Id = ID_PLOT_OFFICIAL_FORECAST Then
    
    'Removes all ID_PLOT_OFFICIAL_FORECAST links and Folders
    For Count = CommandBar.Controls.Count To 1 Step -1
     'link
     If CommandBar.Controls(Count).Id > 0 Then
      CommandBar.Controls(Count).Delete
     End If
    Next
    
    '***Now add all dynamic links for ID_PLOT_OFFICIAL_FORECAST
    'It is up to you to set the start and end position for the number of items to add to this popup
    'nStartPos = 1
    'For nPos = nStartPos To nEndPos
    
    'I am only adding 10 items, you can add yours liked described above
    For nPos = 1 To 10
     Set Control = CommandBar.Controls.Add(xtpControlButton, (nPos + OFFICIAL_FORECAST_OFFSET), "Official Forecast " & nPos, , True)
     Control.Caption = "Official Forecast " & nPos
     Control.ToolTipText = "Official Forecast " & nPos
     Control.DescriptionText = "Official Forecast " & nPos
     Control.Style = xtpButtonCaption
    Next
  End If
  
 '*********************Displays ID_PLOT_CLIMATE_FORECAST folder
 If CommandBar.Parent.Id = ID_PLOT_CLIMATE_FORECAST Then
    
    'Removes all ID_PLOT_CLIMATE_FORECAST links and Folders
    For Count = CommandBar.Controls.Count To 1 Step -1
     'link
     If CommandBar.Controls(Count).Id > 0 Then
      CommandBar.Controls(Count).Delete
     End If
    Next
    
    '***Now add all dynamic links for ID_PLOT_CLIMATE_FORECAST
    'It is up to you to set the start and end position for the number of items to add to this popup
    'nStartPos = 1
    'For nPos = nStartPos To nEndPos
    
    'I am only adding 10 items, you can add yours liked described above
    For nPos = 1 To 10
     Set Control = CommandBar.Controls.Add(xtpControlButton, (nPos + CLIMATE_FORECAST_OFFSET), "Climate Forecast " & nPos, , True)
     Control.Caption = "Climate Forecast " & nPos
     Control.ToolTipText = "Climate Forecast " & nPos
     Control.DescriptionText = "Climate Forecast " & nPos
     Control.Style = xtpButtonCaption
    Next
  End If

 '*********************Displays ID_PLOT_PAST_STORM_TRACKS folder
 If CommandBar.Parent.Id = ID_PLOT_PAST_STORM_TRACKS Then
    
    'Removes all ID_PLOT_PAST_STORM_TRACKS links and Folders
    For Count = CommandBar.Controls.Count To 1 Step -1
     'link
     If CommandBar.Controls(Count).Id > 0 Then
      CommandBar.Controls(Count).Delete
     End If
    Next
    
    '***Now add all dynamic links for ID_PLOT_PAST_STORM_TRACKS
    'It is up to you to set the start and end position for the number of items to add to this popup
    'nStartPos = 1
    'For nPos = nStartPos To nEndPos
    
    'I am only adding 10 items, you can add yours liked described above
    For nPos = 1 To 10
     Set Control = CommandBar.Controls.Add(xtpControlButton, (nPos + PAST_STORM_TRACKS_OFFSET), "Past Storm Forecast " & nPos, , True)
     Control.Caption = "Past Storm Forecast " & nPos
     Control.ToolTipText = "Past Storm Forecast " & nPos
     Control.DescriptionText = "Past Storm Forecast " & nPos
     Control.Style = xtpButtonCaption
    Next
  End If
End If
End Sub



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net