Skip to main content
Michael B
Associate III
July 21, 2019
Question

Renaming a screen in Designer causes compilation error

  • July 21, 2019
  • 3 replies
  • 1640 views

Renaming a screen results in a compilation error.

To reproduce:

  1. Create a new project
  2. Rename Screen1 to MainScreen
  3. Run Simulator
Converting images
Compiling gui/src/screen1_screen/Screen1View.cpp
Compiling generated/images/src/slider_vertical_***.cpp
Compiling generated/images/src/pageindicator_highlight.cpp
Compiling generated/images/src/menu_stage_stretch_left_side.cpp
Compiling generated/images/src/slider_vertical_fill.cpp
Compiling generated/images/src/slider_vertical_back.cpp
Compiling generated/texts/src/LanguageGb.cpp
Compiling generated/texts/src/TypedTextDatabase.cpp
gui/src/screen1_screen/Screen1View.cpp:1:46: fatal error: gui/screen1_screen/Screen1View.hpp: No such file or directory
 #include

This topic has been closed for replies.

3 replies

Anders Nedergaard PETERSEN
Senior II
July 22, 2019

Hi @Community member​,

Have you added any code manually to Screen1View.cpp? If so, then we (Designer) will not delete this file since it contains additional code which is not generated by the Designer.

In this case, you should find that the gui src folder contains both a MainScreen and a Screen1View folder.

Delete the Screen1View folder and it should be ok.

Just remember to copy the handwritten code from the old file to the new.

/Anders

Michael B
Michael BAuthor
Associate III
July 25, 2019

Nope it was a fresh project as described above, with no changes at all. I for now just kept the default names for different screens, but obviously not a great solution. I can modify the build by hand I was just surprised that such a simple and common operation didn't work.

Anders Nedergaard PETERSEN
Senior II
July 26, 2019

Normally this operation works in the designer, so it does seem at bit strange, i'll report it to the designer team.

If you still have the "broken" project, please provide a list the files in the gui folder e.g. using "find gui" in the touchgfx environemnt when standing in the root of the project.

/Anders

Martin KJELDSEN
Principal III
August 8, 2019

Hi @Community member​,

I don't have that problem here. Can you please send me the project?

/Martin

wired
Senior II
April 5, 2022

This was identified as a bug in 4.18 when I submitted support case 145131 for this very issue. They said they would look into it for the next release. Well, now 4.19 is here. I have not installed it yet, so am wondering if this problem still exists? I just renamed a screen and had to go in and modify about six gui files, since all TouchGFX does is create a new set of View and Presenter files when you rename a screen. I had to manually change all of the class names and header file names to reference the new name.

I just found this thread, and I see that this bug has existed for over three years now and was not fixed as of 4.18, so I'm not holding out much hope...

Osman SOYKURT
ST Technical Moderator
April 7, 2022

Hello wired,

Unfortunately still in 4.19.0. Indeed we don't want to modify user code (we only modify generated code) because deleting/renaming theses old named files (that contains user code) is a bit dangerous. It's not just about creating new files and copy user code into it sadly. But I pushed again this issue to my team and I believe we can find a solution to this soon. We'll get back to you as soon as possible..

/Osman

ST Software Developer | TouchGFX
wired
Senior II
April 7, 2022

Hi Osman,

Seems to me to be no more difficult than doing a search and replace of class names and include files, and renaming of the existing files to contain the new screen name. That is what I had to do.

At the very least, if nothing is going to be done about it, you could pop up a dialog stating that changing the screen name once user code has been added may result in compilation errors, and confirm that they want to continue. It is never a good idea to allow someone's code to break by performing an allowed action in the application. You know, because of the old "just going to rename this screen before showing the boss my demo" scenario ;)