Is hard to say without seeing your project as it should work, but the first thing I will look will be if the Layout "gra" has linked properly to the Event sheet where you have the code which is "gra" Event Sheet
-Click on the Layout "gra"
-At the left in the Properties Panel like you show in your first picture check where it says "Event Sheet" it should be >>> gra
-if it doesn't show gra just change it to gra and it should work
-but if you have "gra" already and is not working then the problem it should be somewhere else, if you post a minimum capx someone can have look and fix it much quicker