Print Page | Close Window

SOLVED:How can i put current oclock in statusbar

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=16405
Printed Date: 27 September 2024 at 11:18am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SOLVED:How can i put current oclock in statusbar
Posted By: unforgiven
Subject: SOLVED:How can i put current oclock in statusbar
Date Posted: 10 March 2010 at 10:00am
I want to put current time in statusbar,but i can't how can i do that?
is there any way to put time in statusbar .
current time show in control timer.
I don't know how can i use of timer control to combine statusbar
thaks all



Replies:
Posted By: younicke
Date Posted: 10 March 2010 at 6:36pm
just use the update event of the commandbars and change the caption of the statusbar pane with the current time


Posted By: unforgiven
Date Posted: 11 March 2010 at 3:15am
Hi younick
as you told i use update event but i face to error:

Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
Dim StatusBar As IStatusBar
Dim Pane As StatusBarPane
Set Pane = StatusBar.AddPane(ID_TIME_PANE)
Pane.Text = Time$
End Sub
----------------
to show current time i use timer control

Private Sub timehoure_Timer()
On Error Resume Next
If Label2.Caption <> CStr(Time) Then
Label2.Caption = Time$
End If
End Sub

pls put right code or trim my code
thanks


Posted By: Oleg
Date Posted: 11 March 2010 at 7:59am
Hi,
Don't add new pane on each run - Find pane you added before and update its text.


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


Posted By: younicke
Date Posted: 11 March 2010 at 8:26am
no more timer control needed.. just the update event of the commandbars.

define the statusbar panes in the form load event
and in the updateevent of the commandbars search
for the pane that you want to show the current time
and then replace the text with the current time


Posted By: cmm2006
Date Posted: 11 March 2010 at 12:49pm

I know that you can use the following codes to add (CAPS, NUM,...):

    StatusBar.AddPane ID_INDICATOR_CAPS
    StatusBar.AddPane ID_INDICATOR_NUM
    StatusBar.AddPane ID_INDICATOR_SCRL
 
is there any way that we can add time or date (ID_INDACATOR_TIME, ID_INDICATOR_DATE) ?
Thank you


-------------
Language: Visual Basic 6 SP6
OS: Windows XP Pro SP3
Product: Codejock Xtreme SuitePro 13.1


Posted By: unforgiven
Date Posted: 11 March 2010 at 1:43pm
for showing date i use this code on form_load event:

Dim StatusBar As IStatusBar
    Set StatusBar = CommandBars.StatusBar
    
    StatusBar.Visible = True
    Dim Pane As StatusBarPane
      
    Set Pane = StatusBar.AddPane(ID_DATE_PANE)
    Pane.Visible = True
    Pane.Text = " Today : " & Date
    Pane.Width = 0

it's work fine,but for showing current time, i got error
--------------------------------------------------------
with this code i can show time in statusbar,but time is fixed and not change second of it,what's the problem?

Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
Select Case Control.Id
Case ID_TIME_PANE
CommandBars.StatusBar.FindPane(ID_TIME_PANE).Text = Time$
End Select

please put code or trim my code to solve this problem
thanks


Posted By: younicke
Date Posted: 11 March 2010 at 5:54pm
Private Sub Form_Load()
    ....

    Dim Pane As StatusBarPane

    Set Pane = CommandBars.StatusBar.AddPane(ID_INDICATOR_TIME)
    Pane.Alignment = xtpAlignmentCenter
    Pane.Text = DateTime.Time
    Pane.Width = 0

    ....
End Sub

Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
    Set Pane = CommandBars.StatusBar.FindPane(ID_INDICATOR_TIME)
    Pane.Text = DateTime.Time
End Sub



Posted By: unforgiven
Date Posted: 12 March 2010 at 3:07am
Dear Younicke
your code is Ok and work fine.
I appreciate for your reply


Posted By: younicke
Date Posted: 12 March 2010 at 5:37am
you're welcome



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