itemisCREATE / statecharts

YAKINDU Statechart Tools (http://www.statecharts.org)
Eclipse Public License 1.0
175 stars 85 forks source link

Event not raised #2534

Closed Vdogg closed 5 years ago

Vdogg commented 5 years ago

Hello !

I'm developping a statechart of an old radio tape reader. The one that buttons jumps when you push some others (or the stop button), remember? ;-).

So , i've made 4 buttons : Play, stop, fastforward and fastbackward. They work correctly : While pushing one , it triggers an event named "jump" ( raise jump ), and change states of the other buttons to Off.

Recently i have made another button named Record. He have exactly the same behaviour (except the name). But guess what? It doesn't raise the jump event (Region 8 Jumper doesn't react) like it should do.

The version i use is the 3.4.3.2018.11121440 embedded in eclipse. (Note : i tried to check with the Yakindu standalone version. But while i import project, i get : org.eclipse.ui.ide.FileStoreEditorInput cannot be cast to org.eclipse.ui.IFileEditorInput Perhaps another issue? )

The file is joined with the message.

Radio V3.zip

Thanks in advance , you are doing great work !

tkutz commented 5 years ago

Hello!

Sorry for not answering for such a long time. Somehow this issue went under our radar... :(

I took a look into your example and I see two solutions here:

Solution 1: Change the execution semantics to event driven (add @EventDriven in your definition section) and change the jump event to be an internal event instead of an in event. With these changes the push record scenario work, but you need to change more parts in your statechart to make it work in an event-driven fashion.

Solution 2: Change the order of the region execution. When you added a new region for the record button, this region was added last to the execution order list. In a cycle-based statechart (as it is per default) a raised event is only visible to subsequent regions and not the previously executed ones. You can change this order in the statechart properties: Right-click on the background canvas of your statechart -> Show properties view -> Region Priority.

See also this part in our documentation for more details: https://www.itemis.com/en/yakindu/state-machine/documentation/user-guide/sclang_reactions#sclang_raising_and_processing_an_event