WebTimer help...

Is this correct?

To get a single Action event in 2 ms.

Start it.

MyTimer.Mode = Timer.ModeSingle MyTimer.Period = 2 // 2ms MyTimer.Reset

MyTimer.Action

MyTimer.Mode = Timer.ModeOff

Should I have used Enable?

I generally don’t set the mode until after I’ve set the period property and I never use Reset. Enable is unnecessary.

MyTimer.Period = 2 // 2ms
MyTimer.Mode = Timer.ModeSingle

Is the Action event not firing? Where are you setting the time up from? An event? Open or Shown?

In the [quote=268141:@Bob Keeney]I generally don’t set the mode until after I’ve set the period property and I never use Reset. Enable is unnecessary.

MyTimer.Period = 2 // 2ms
MyTimer.Mode = Timer.ModeSingle

Is the Action event not firing? Where are you setting the time up from? An event? Open or Shown?[/quote]

The action fires in 32 bit, but not 64 bit.
I have a WebFileUploader dialog and it raises events when the data has uploaded.
I was doing processing in that event handler and decided that might ‘not’ be a good idea so in that event handler I now setup the timer and then do the processing in the timer action event.

[quote=268146:@Brian O’Brien]I have a WebFileUploader dialog and it raises events when the data has uploaded.
I was doing processing in that event handler and decided that might ‘not’ be a good idea so in that event handler I now setup the timer and then do the processing in the timer action event.[/quote]
Hm…I’ve not had issues with the WebFileUploader events not working properly. If anything, I’d say the FileUploader events are better than the timer.

But I’ve not used it in recent versions, nor in 64 bit. Honestly, I’d report the event issues via Feedback (with example projects) because those might affect a lot of users.

Building an example project of this is going to be an issue and I’m not sure I can reproduce…
Sure wish I could debug in 64 bit!
I will try.

You can’t now debug in 64-bit because xojo is only 32-bit. I use Timer a little bit different. Firstly I insert timer in webpage then I set in inspector(right panel) Mode on Off and Period which I want. When I want to run timer, I use in code Timer1.Mode= timer.ModeMultiple and in Timer1 I have my code and at the end me.Mode = timer.ModeOff. This run timer only once, because with ModeSingle I had any Problem. I think that with ModeSingle I can’t used Timer1 twice. This Timer works in 64-bit good.

2 ms looks awfully tight for a webTimer. You may want to verify it actually fires at this rate.

It will on Mac, maybe, but not on Windows.

We are not talking about a desktop app, where indeed a Mac timer can reliably fire at 2ms or less.

Don’t forget the round trip needed to manage the Action code. Local here on my Mac I get 11-14 ms between Action events.

On the remote Web, the average ping is more in the range of 130 ms.

The only way to really get lower would be to use entirely client side code, maybe in JavaScript.

Actually, all depends of what the timer is needed for. To get shorter periods, the simplest is to use a server side timer, the same class as the desktop timer.

I read in another thread the 2ms was light, so I increased it to 500ms, still it didn’t fire.
I will work on reproducing in a small project but I may have to submit the whole app.

[quote=268229:@Brian O’Brien]I read in another thread the 2ms was light, so I increased it to 500ms, still it didn’t fire.
I will work on reproducing in a small project but I may have to submit the whole app.[/quote]

Looks like something is wrong in your program. You may want to put a debuglog right after your code to make sure it is executed.

If I can believe that output from System.DebugLog then I have narrowed it down to a method in a class.
I’m trying to see if there is an unhandled exception that seems only to be raised in 64 bit.

[code]Sub AddMessage(m as Message)
System.DebugLog(">AddMessage")

dim mv as new MessageView

System.DebugLog(“MessageView created”)

mv.msg=m

MakeEntityIfNew(m.Sender)
MakeEntityIfNew(m.Receiver)

mMessages.Append(m)
mMessageViews.Append(mv)
System.DebugLog("<AddMessage")

Exception
System.DebugLog(“Runtime exception caught”)

End Sub[/code]

I just added the Exception statement to this method as the debug log showed
“>AddMessage” and just stopped there.
Since adding the exception I have at least gotten past that.
So it now shows:

">AddMessage
Runtime exception caught

This must mean that dim mv as new MessageView is causing a problem.
But there are no methods of that class being called. Except for the native constructors of which i have not implemented any.

Suggestions?

This is the current exception that is being generated.

May 26 13:34:04 test[45341] : >AddMessage
May 26 13:34:04 test[45341] : An exception of type xojo.Core.BadDataException was caught.

What in the name of is that? :slight_smile:

Since I dont have your code the best I can suggest is looking at
http://developer.xojo.com/xojo-core-baddataexception

Add a system.debuglog(“1”) after each line of code, increment the number in there so you know where its faulting, 1 2 3 4 5 etc

When you have found the line, comment it out to make sure its that and not some other bizarre bug causing something to point there.

if it errors on a Sub, go in there and repeat with more system.debuglog

Let us know where it errors.

[quote=268316:@Norman Palardy]Since I dont have your code the best I can suggest is looking at
http://developer.xojo.com/xojo-core-baddataexception[/quote]

Thanks norman but I’m having difficulty reproducing this in an example project.
As there is no 64 bit debugger and as I can not ‘legally’ submit my source code… I’m at a bit of a disadvantage.

Perhaps you can help me dump the call stack and exception details?

I’ve narrowed it down to this line of code (If I can believe the System.DebugLog lines)

System.DebugLog(">AddMessage")
dim mv as new MessageView

Then I get the Exception message.

Does that have to be

Dim x as Type = New Type?

[quote=268317:@JulianS]Add a system.debuglog(“1”) after each line of code, increment the number in there so you know where its faulting, 1 2 3 4 5 etc

[code]Sub AddMessage(m as Message)
System.DebugLog(">AddMessage")

dim mv as new MessageView

System.DebugLog(“MessageView created”)

mv.msg=m

System.DebugLog(“Message set”)

MakeEntityIfNew(m.Sender)
MakeEntityIfNew(m.Receiver)

System.DebugLog(“Entities made”)

mMessages.Append(m)

System.DebugLog(“message appended”)

mMessageViews.Append(mv)

System.DebugLog(“message view appended”)

System.DebugLog("<AddMessage")

Exception e As RunTimeException
System.DebugLog(“An exception of type " + e.eType + " was caught.”)

End Sub[/code]

May 26 13:34:04 test[45341] <Warning>: >AddMessage May 26 13:34:04 test[45341] <Warning>: An exception of type xojo.Core.BadDataException was caught.

Yeah I see that now, more debugging doesnt help.

What is MessageView? Class? Plugin?