Timer.CallLater question

Hello!

I’m still pretty green with xojo, so this is likely a silly question… but, I’m having an issue with the Timer.CallLater shared method and was wondering(hoping) if someone can show me the light!

Ok, so here is my code:

[code]
Select Case mode
Case UI.CombatDisplayMode.Attack
// do nothing

Case UI.CombatDisplayMode.Msg

// hide panel
timer.CallLater(5000, AddressOf hideMsg, msgCurrent.copy)
closing = true

Case UI.CombatDisplayMode.Result

// hide panel
timer.CallLater(5000, AddressOf hideResult)
closing = true

End Select[/code]

Which I thought was alright, but I now get the error “There is more than one item with this name and it’s not clear to which this refers.”, pointing to the two callLater calls. Removing the callWithArgs call, and everything runs fine.

Is it a problem with the hideMsg() function? It’s signature matches the value returned from msgCurrent.copy, so thought it fits the callWithArg delegate. And I can’t find anything further to explain in the docs

Can anyone show me why I’m being a derpy noob?

Make sure your timer is a Xojo.Core.Timer. In Desktop or Web, Timer without Xojo.Core does not have CallLater.

Sorry, this is from an iOS project, so xojo.core.timer is the only timer available.

What are the method signatures for hideMsg and hideResult?

Hey Paul,

Private Function hideResult() Private Function hideMsg(data As UI.dataCombatDisplayMsg)

msgCurrent.copy returns a dataCombatDisplayMsg.

Do they need to be public or is there something else I’m failing with?

timer.CallLater(5000, AddressOf hideMsg, msgCurrent.copy)
timer.CallLater(5000, AddressOf hideResult)

You do not have a variable called timer in the same scope by any chance?

[quote=226939:@Eli Ott]timer.CallLater(5000, AddressOf hideMsg, msgCurrent.copy)

timer.CallLater(5000, AddressOf hideResult)

You do not have a variable called timer in the same scope by any chance?[/quote]

Calling a control by the class name is probably not a very good idea in the first place. The compiler may get confused.

Your parameter needs to be of type Auto. You can convert it to the proper type inside the method:

Private Function hideMsg(data As Auto) Dim realData As UI.dataCombatDisplayMsg = data End Function

I’m not seeing an error with hideResult.

[quote=226939:@Eli Ott]timer.CallLater(5000, AddressOf hideMsg, msgCurrent.copy)

timer.CallLater(5000, AddressOf hideResult)

You do not have a variable called timer in the same scope by any chance?[/quote]

(hangs head in shame a little) doh…

(hangs head in shame a little bit more) doh, doh!

[quote=226973:@Paul Lefebvre]Your parameter needs to be of type Auto. You can convert it to the proper type inside the method:

Private Function hideMsg(data As Auto) Dim realData As UI.dataCombatDisplayMsg = data End Function

I’m not seeing an error with hideResult.[/quote]

Thanks Paul! That was it, (as well as my terriblepractice programming), changing the type to an auto and all is well. (Renamed the class property timer also, cheers Eli and Michel :)).