Print Page | Close Window

CommandBarEdit SpinButtons

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=6220
Printed Date: 18 June 2025 at 7:32pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CommandBarEdit SpinButtons
Posted By: spol
Subject: CommandBarEdit SpinButtons
Date Posted: 25 January 2007 at 3:52am
Hi all,
I would like to create a date-time picker. I added a xtpControlEdit commandbar with the ShowSpinButtons set to true and set its text to now(). But when I click on one spin button the text turn to a number and it work as un up-down counter. Is there a way to intercept the ShowSpinButtons events so that I can add and substract one hour to the the control text?
Thanks,
Paolo



Replies:
Posted By: Oleg
Date Posted: 25 January 2007 at 5:07am
Hi,
 
here workaround:
 
Private Sub CommandBars1_ControlNotify(ByVal Control As XtremeCommandBars.ICommandBarControl, ByVal Code As Long, ByVal NotifyData As Variant, Handled As Variant)
    If (Control.Id = 100) Then
        If (Code = 4112) Then
            Control.Text = "Some new Text+"
            Handled = True
        End If
        If (Code = 4113) Then
            Control.Text = "Some new Text-"
            Handled = True
        End If
    End If
End Sub


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: spol
Date Posted: 25 January 2007 at 5:15am
That's work perfectly !!!
Thank you very much!


Posted By: bobmazanec
Date Posted: 09 July 2007 at 1:36pm
I'm doing a similar thing with a simple CommandBarEdit whose value I want to keep positive.
 
When I set Handled=True (as shown in the "workaround"), I can check the value and modify the Text.  However, the Up/Down keys no longer activate the corresponding spinner buttons.
 
When I leave Handled=False, the Up/Down keys work as expected, but any changes I make to the CommandBarEdit's Text are lost/overridden.
 
I have also tried checking/setting the Text and setting Handled=True in the Code 768 handler, but still to no avail.
 
Any suggestions?


Posted By: Oleg
Date Posted: 10 July 2007 at 12:22am
Yes, when control has focus Control.Text property will not work. as solution use SetWindowText API:
 
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
...

   If (Control.Id = 1300) Then
        If (Code = 4112) Then
            SetWindowText Control.EditHandle, "Some new Text+"
            Handled = True
        End If


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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