Calculator Tutorial problem

I'm stuck at the point where the input fields have been added to MyCalc in the sandbox, and I need to add a blank line followed by an output field. The tutorial says

"We separated input fields from output field with an empty cell in order to divide input fields from output fields. In order to add it, put caret after inputField's cell and press Enter, then choose constant."

When I put the caret after the inputField's cell and press Enter, I get a new line with another inputField on it:

...

input height

input depth

input <no name>

I see no way of 'choosing constant' at this point.

What is the trick?

12 comments
Comment actions Permalink

Hello, Dave.

It seems that you tried to add code to the wrong place. You should open editor's editor, not instance's editor. In order to do so, find Calculator concept in language's node in project view. Open it and go to editor tab

0
Comment actions Permalink

Hi Konstantin,

OK - yes, you're right, I was confused by the odd relation between the screenshots and the text...

It would be easier to follow if all the text pertaining to a screenshot is consistently presented before it (or after it) so that it is always clear to which screenshot it applies.

Thanks for your help.

0
Comment actions Permalink

I still have a problem at this point - I now have the constant between the input and output fields in the calculator editor, and I've generated the language again, but when I go to the MyCalc tab to look at the sandbox concept, I don't see what the screenshot shows (the blank line after the input field and the << ... >> for entering the output field), and whatever I try, I can't add the output field...

http://www.jetbrains.com/mps/docs/tutorial/image036.png

Either this tutorial is a bit raw, or the MPS interface needs a lot more work - I understand roughly what is going on, but using the editor is a struggle all the way.

0
Comment actions Permalink

You should press Insert or Enter at this point in order to add a new output field. You can read more about how to use editor in Appendix A in our tutorial.

0
Comment actions Permalink

Hi Konstantin,

The MyCalc tab currently looks like this:

http://www.jetbrains.com/mps/docs/tutorial/image031.png

I am trying to get to the point shown by the image in my previous post. If I press Insert or Enter at this point (above), I just get another input field - I can't find how to get the blank line and the field area for the output field displayed. I have checked the other tabs and they all look the same as the screenshots in the tutorial at this point. I have tried generating and regenerating all the nodes that have those options, and it all seems fine.

I'm clearly missing something, because the sandbox calculator isn't picking up the output field from the model, but I can't see what. Is there anything else besides generating and regenerating the language and sandbox nodes that I should do?

I have looked at the editor appendix and it all makes sense - maybe it just takes a while to become familiar with using it. I don't usually have this kind of difficulty with new environments, but it's different from most I've tried.

Thanks for your patience :-)

0
Comment actions Permalink

In order to show output fields in calculators editors you need to change the calculator's concept editor so it looks like on the screenshot in the attached file. You need to add %outputField% below the empty constant cell.



Attachment(s):
image035.png
0
Comment actions Permalink

That's exactly what I did following your reply to my first post, and my concept editor now looks exactly like that. As I said, my project now compares exactly to the screenshots up to that point in the tutorial - except for the MyCalc tab.

According to the tutorial, from there the next step is "Now let's generate our language and take a look at our sandbox concept:", so I generated the language and clicked on the MyCalc tab, but it looked the same - no blank line, no new field prompt. So then I generated/regenerated all the project nodes that offered those options, hoping that the sandbox would be updated, but no dice.

But hold the presses - good news!  I just closed the project and reopened it again, and the sandbox calculator MyCalc tab now shows the updated version with the blank line and field prompt. Looks like it was just a glitch that it didn't update properly before. TGFT!

Thanks again for your help Konstantin, here's hoping I get through the rest of it without problems ;-)

Dave

0
Comment actions Permalink

Argh! I spoke too soon. When I try to add the output field to the sandbox calculator it gives me one option 'OutputField - BaseConcept in d.mps.calculator'. If I select it (or press insert or enter), it displays: <abstract concept> for the field, so I go from:

...

inputwidth

inputheight

inputdepth


<<  ...  >>



Via a prompt for OutputField, to:

...

inputwidth

inputheight

inputdepth


<abstract concept>

I'm beginning to think this project has some problems... I'm inclined to delete it and start again - some other time.



0
Comment actions Permalink

As I can see, you probably declared the wrong kind of child for outputFields. Take a look at outputField child's declaration. You should have OutputField not BaseConcept.

0
Comment actions Permalink

> you probably declared the wrong kind of child for outputFields.

If you mean the child OutputField in the Calculator concept, it's exactly as shown in the tutorial screenshot.

> Take a look at outputField child's declaration. You should have OutputField not BaseConcept.

Yes, it looks correct - it's declared as OutputField.

But, since I closed and reopened the project, I see the OutputField editor has lost its node cell layout entry, and the MyCalc project node in the sandbox has gained a whole bunch of outputField nodes that don't show in the MyCal tab (6 or 7 of them), under the three inputField nodes.

OK - now I've re-entered the OutputField node cell layout, and deleted the spurious outputField nodes from under the sandbox MyCalc node, and regenerated everything... and finally, I can now add the output field to the calculator. Right, it all looks OK now.

This must be the strangest tutorial I've ever followed - I really don't understand why closing and reopening the project would seem to fix one problem but cause those other changes. I guess something is a little unstable.

OK, on we go - to expressions.

0
Comment actions Permalink

Could you send me your project? (at kostik@jetbrains.com) We've tested this tutorial thoroughly and we didn't have any problems which required restarting MPS.

0
Comment actions Permalink

You have email.

0

Please sign in to leave a comment.