Web 2.0 HashtagChanged Firing Programmatically

When changing the hashtag programmatically the WebSession.HashtagChanged event fires. It’s been awhile since I’ve used hashtags so, this could’ve changed. I was under the impression that changing the hashtag within the app wouldn’t fire the WebSession.HashtagChanged event? I checked the hashtag example and it also fires the event. Is this intentional?

It might be, but I’d argue that it’s wrong. I, like you, feel that it shouldn’t fire when changed programmatically. You’re able to do whatever you might need to do in code when you change it, so you don’t need to be notified. You should open a Feedback Case.

It’s probably because it’s a round-trip notification. You do it in code, the change is sent to the client, the client says “Hey, this changed”, so the event is raised. A little creative coding could fix it if that’s the case.

1 Like

I’m quite the opposite. In my opinion, the event is HashtagChanged not, HashtagChangedByUserAction. I use changed events to set things up regardless of who/what triggered it.

By removing the ability to always raise this event, you prevent others from implementing things when all you need is a flag for “did I do this by code”. Because of this, I would argue that changing the functionality removes capabilities from other users (such as myself).

Edit: So, I suppose, the best case Feedback ticket for everyone would be to add a new event for HashtagChangedByUserAction

1 Like

Honestly, either works for my case. I just didn’t want to do it one way and then it’s “fixed” the next week. Ha!

I just discovered it because of this.

You’re able to do whatever you might need to do in code when you change it, so you don’t need to be notified.

I had code running on a button pressed (which changed the hashtag as well) and the same code when using the hashtag. So essentially I was running the same code twice.

Yeah, either way is fine as long as you’re aware of what’s going to happen. You could even set a property in your session when you’re going to change it programmatically then toggle it off when the event fires, if you really want to push toward no change in the event.

I just tend to dislike it when the framework tells me about something I know I already did.

1 Like

I’ve built a sample project for Web 2.0 that shows how to ignore hashtags changed by code:
Ignore Hashtag By Code.xojo_xml_project

1 Like

Pretty neat idea. Thanks Tim.