cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Event router widget for calculator application to create expression.

sbt
15-Moonstone
15-Moonstone

Event router widget for calculator application to create expression.

Hello,

I tried using event router for building calculator based application, but i see that the output is not getting changed on every click.

below image for reference when i tried.

In the above image for button 1 & 2 click the context id mapped with same 1 & 2 are not getting displayed in the output text box, but if i write anything on the other two text boxes and on leave from the text box, i am able to see the same in the output text box.

what am i missing in the button that i am not able to see the respective context ID in the out put text control on click ..???

Thanks

Sunay

8 REPLIES 8
posipova
20-Turquoise
(To:sbt)

What is your ContextID bound to (what contents are you passing into the event router)?

ALso, the output of the events router is the last input provided.

sbt
15-Moonstone
15-Moonstone
(To:posipova)

I have hard coded the value which needs to be passed to button context ID. and i have mapped the ContextID to inputs of the event router as you can see in my first image.

qngo
12-Amethyst
(To:sbt)

Hi,

the problem is event Clicked of button doesn't send the ContextId again to EventRouter. It's bound only once on load.

You can use an Expression widget to send ContextId from button to EventRouter. The button Clicked event can be bound to service Evaluate of Expression widget.

sbt
15-Moonstone
15-Moonstone
(To:qngo)

So if i have 20 buttons then i need to use 20 expression widgets..?

qngo
12-Amethyst
(To:qngo)

I'm afraid that's the case..

If there are 20 buttons, it would be better to have a dropdown list to select.

sbt
15-Moonstone
15-Moonstone
(To:qngo)

Quang,

I need to implement a calculator setup and i think if i need to implement those many expression widgets as many as buttons, then it would not be a ideal solution i guess

qngo
12-Amethyst
(To:qngo)

Another way is a service which return simply the String input. In this case, the contextId can be bound to that input. The Clicked event invoke the service which returns the contextId to EventRouter. Of course, you need to add the same service as many as buttons.

sbt
15-Moonstone
15-Moonstone
(To:qngo)

yes there also i cannot map multiple context id's of the buttons to a single service, so i need to create multiple services as many as buttons.

Announcements


Top Tags