Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Timer stopping on deactivate

100 views
Skip to first unread message

Rahul

unread,
Aug 2, 2006, 10:03:08 AM8/2/06
to
I am displaying current time on a window in a static text
and have this code in timer event:
st_4.Text =String(DateTime(Today(), Now())," hh:mm:ssam/pm")

Also have Timer(1, w_winname) in Open event.
This window has set of buttons (in user object). Once I
click a button the clock stops (window timer stops).
I tried calling Timer function in deactivate and activate
event - only works in deactivate event.
Any one has any idead on this - please share.

Thanks
Rahul

Chris Pollach

unread,
Aug 2, 2006, 10:18:21 AM8/2/06
to

Watch out for the method of instantiation or multiple-instantiations. The
better way to code that would be:
Timer (1, THIS) in the Open OR
Timer (1, PARENT) in the CB

Also, is there somewhere else where you might have issued a Timer (0)?


<Rahul> wrote in message news:44d0b09c.55e...@sybase.com...

Terry Voth

unread,
Aug 2, 2006, 10:55:01 AM8/2/06
to
I'm a little confused by the wording of your question, but I'll take a crack at
it.

Firstly, if this is the only functionality (showing date/time) of this timer, it
can be achieved without scripts with an external DataWindow with *its* timer
turned on and one computed column showing the date/time.

Second question is, what do you mean by "stop?" One thing to note is that timer
scripts will not be able to run while other scripts are running, unless the
other scripts allow it with a Yield().

Lastly, I'd agree with Chris about being careful about using implicit global
variables (e.g. w_WinName, where w_WinName is the object name you see in the
library painter or system tree). That has a tendency to cause problems,
especially when multiple instances of the same class can be opened.

Good luck,

Terry [TeamSybase] and Sequel the techno-kitten

On 2 Aug 2006 07:03:08 -0700,
in sybase.public.powerbuilder.general
<Rahul> wrote:

*********************************
PowerBuilder for $95? No.
Personal use PowerBuilder Enterprise *AND* PocketBuilder *AND* DataWindow.NET
*AND* Sybase IQ as free benefits of am ISUG membership. See
http://www.isug.com/ISUG3/Membership_benefits.html for details.

*********************************
Click once a day to help the hungry
http://www.thehungersite.com
*********************************
User Manual
===========
TeamSybase <> Sybase employee
Forums = Peer-to-peer
Forums <> Communication with Sybase
IsNull (AnswerTo (Posting)) can return TRUE
Forums.Moderated = TRUE, so behave or be deleted
*********************************

Sequel's Sandbox: http://www.techno-kitten.com
Home of PBL Peeper, a free PowerBuilder Developer's Toolkit.
Version 3.0.02 now available at the Sandbox
PB Futures updated Apr 24/2006
See the PB Troubleshooting & Migration Guides at the Sandbox
^ ^
o o
=*=

Rahul

unread,
Aug 2, 2006, 11:23:50 AM8/2/06
to
Yes, tried that still it stops the timer.
I have not issued Timer (0).

Chris Pollach

unread,
Aug 2, 2006, 12:50:20 PM8/2/06
to

What version of PB and O/S are you using?
This is very strange - I have never seen this one!


<Rahul> wrote in message news:44d0c386.56b...@sybase.com...

Chris Pollach

unread,
Aug 2, 2006, 1:02:01 PM8/2/06
to
Rahul;

FYI: A more efficient way (alternative) would be to use a DataWindow ...

1) Create a tabular "external" DWO and assign the column name DUMMY.
2) Add a Computed Column (CC) to the header band and use the Today( )
method.
Stretch out the column so you can see the Date & Time.
3) Remove the "Dummy" title and column name from the bands.
4) Collapse the Detail band (ie: height =0)
5) Set the Display Mask of the CC to your liking
6) In the DWO's general properties tab page set the "Timer Interval" to 1000
(ms).

You should see the "real time" display in the "Preview" Pane now! Save the
DWO.

Now replace that Static Text object with your Time DWO. You can now use this
anywhere in your application where a real-time display of the current time
is required. Also .. NO Coding will ever be required again!!!!

HTH

Regards ... Chris
PS: Have you "hugged" your DW today?


<Rahul> wrote in message news:44d0b09c.55e...@sybase.com...

Rahul

unread,
Aug 3, 2006, 8:36:44 AM8/3/06
to
PB 10.2.1 Build 9597
I noticed there is a Timer (0) in the mdi window (main
window) but do not know if it should affect this window
which contains the timer event.

Rahul

unread,
Aug 3, 2006, 9:38:12 AM8/3/06
to
Yes, this is correct method for my requirement.
Thanks a lot.

Chris Pollach

unread,
Aug 3, 2006, 1:51:28 PM8/3/06
to

No .. works great on my PB 10.2.1 9004.


<Rahul> wrote in message news:44d1eddc.640...@sybase.com...

0 new messages