Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - CommandBarEdit SpinButtons
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CommandBarEdit SpinButtons

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


Joined: 04 November 2005
Location: Italy
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote spol Quote  Post ReplyReply Direct Link To This Post Topic: CommandBarEdit SpinButtons
    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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
spol View Drop Down
Groupie
Groupie


Joined: 04 November 2005
Location: Italy
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote spol Quote  Post ReplyReply Direct Link To This Post Posted: 25 January 2007 at 5:15am
That's work perfectly !!!
Thank you very much!
Back to Top
bobmazanec View Drop Down
Newbie
Newbie


Joined: 26 April 2007
Location: United States
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote bobmazanec Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.

This page was generated in 0.078 seconds.