Add DateTimePicker to a RibbonBar |
Post Reply |
Author | |
cmm2006
Senior Member Joined: 26 September 2006 Status: Offline Points: 118 |
Post Options
Thanks(0)
Posted: 19 July 2009 at 3:42pm |
Hi,
I was just wondering in how to add a custom control (DateTimePikcer) to a ribbonbar. when I tried the following code:
Set ItemCustom = GroupView.Add(xtpControlCustom, ID_VIEW_BY_DATE, "By Date:", True, True)
ItemCustom.Handle = TimePicker.hWnd the DateTimePicker control is shown on the ribbonbar with no problem when I first run the application, but the caption "By Date: " is not shown, plus when I click the dropdown arrow to select the date, the DateTimePicker is moved to the default location where was first place in the design mode.
Any idea why or how to get this to work?
Thank you
|
|
Language: Visual Basic 6 SP6
OS: Windows XP Pro SP3 Product: Codejock Xtreme SuitePro 13.1 |
|
JantjeKeizer
Groupie Joined: 12 February 2008 Status: Offline Points: 70 |
Post Options
Thanks(0)
|
Can't test it right now, but in my experience setting the handle property of the actual control often causes problems.
Try to place it in a picturebox and give that handle. |
|
markp.uk
Groupie Joined: 23 August 2006 Status: Offline Points: 38 |
Post Options
Thanks(0)
|
I had the same problem and solved it with a combo box. handle the position problem in the InitCommandsPopup event of the command bar, as below.
Dim Combo As CommandBarComboBox Dim Control As CommandBarControl Dim DatePicker As XtremeCalendarControl.DatePicker If CommandBar.Parent.Type = xtpControlComboBox Then Set Combo = CommandBar.Parent Set Control = Combo Select Case Combo.Id Case ID_PREDICT_START, ID_CHART_START dppStart.VisualTheme = xtpCalendarThemeResource Set DatePicker = dppStart strCurrentDate = m_strPopupStartDay Case ID_PREDICT_END, ID_CHART_END dppEnd.VisualTheme = xtpCalendarThemeResource Set DatePicker = dppEnd strCurrentDate = m_strPopupEndDay End Select If Combo.Id = ID_PREDICT_START Or Combo.Id = ID_PREDICT_END Or Combo.Id = ID_CHART_START Or Combo.Id = ID_CHART_END Then 'get the current value of the combo box strCurrentDate = Combo.Text bRestore = False If IsDate(Combo.Text) Then DatePicker.EnsureVisible Combo.Text End If Combo.GetRect lngLeft, lngTop, lngRight, lngBottom 'GetPosition lngLeft, lngTop, CommandBar, Combo DatePicker.Left = lngLeft DatePicker.Top = lngTop + (lngBottom - lngTop) Debug.Print lngTop If DatePicker.ShowModal(1, 1) Then Dim strDate0 As String, strDate1 As String Dim nCount As Long nCount = DatePicker.Selection.BlocksCount If nCount > 0 Then 'Control.Refresh Combo.Clear Combo.AddItem DatePicker.Selection.Blocks(0).DateBegin Combo.AutoComplete = True Combo.Text = DatePicker.Selection.Blocks(0).DateBegin strDate0 = DatePicker.Selection.Blocks(0).DateBegin strDate1 = DatePicker.Selection.Blocks(nCount - 1).DateEnd Else Combo.Clear Combo.AddItem strCurrentDate Combo.Text = strCurrentDate strCurrentDate = "?-?-?" End If Else Combo.Clear Combo.AddItem strCurrentDate Combo.Text = strCurrentDate strCurrentDate = "?-?-?" End If Combo.ListIndex = 1 cbMain_TrackingModeChanged CommandBar, False SendKeys vbCrLf End If End If works fine for me. good luck
|
|
The weekend has landed.....
Long live the weekend!!! Product: Xtreme SuitePro (ActiveX) version 16.3.1 Platform: Windows XP (32bit) - SP 3 Language: Visual Basic 6.0 SP6 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |