Jump to content
IgorSavkic

Renaming form in ObjectInspector

Recommended Posts

This is same problem from 2.x version, but it's worse now, then it was possible to fix it with editing .sfm file, now only solution is to delete form and start again :(

Anyway, just add one form to project (main), then go to File/New/New form, when prompted name it SecondForm, form is created. 

Save project, go to SecondForm, in ObjectInspector change Name to frmSecond, save and project becomes uncompilable.

Share this post


Link to post
Share on other sites
4 hours ago, IgorSavkic said:

Latest, 3.0.2.20

Does this happen with a certain project or are you able to reproduce this from scratch with a new project? I have problems reproducing this from a new project. If it's only in a certain project, can you send the zip to jt at smartmobilestudio.com?

Share this post


Link to post
Share on other sites

I'm using version 3.02.20, for me SMSUpdate says there's no development channel available so cannot try anything newer.

Anyway, try AfterRename, that is the state of the project when error starts to happen.

Share this post


Link to post
Share on other sites
1 hour ago, IgorSavkic said:

I'm using version 3.02.20, for me SMSUpdate says there's no development channel available so cannot try anything newer.

Anyway, try AfterRename, that is the state of the project when error starts to happen.

I couldn't reproduce this with 3.0.2.20 either. What I need are clear steps to reproduce this with the BeforeRename-project. When I can do that, then I can run the IDE in Delphi to find out what goes wrong.

So, something like this:

  1. Extract BeforeRename to a new folder
  2. Start SMS ide
  3. Open BeforeRename-project
  4. ???
  5. ???
  6. ???
  7. Press enter -> Boom.

Share this post


Link to post
Share on other sites

Ahh, now I get it. You're renaming from the Property Inspector and not from the Project Manager. I can reproduce this reliably now. Next step is to fix it.

Share this post


Link to post
Share on other sites

I'm starting to get an idea of where the problem is. But before I can fix this, I'd like to ask you guys for your opinion on what the expected behavior should be. Because currently the renaming happens differently in the Property Inspector and Project Manager:

  • Through Project manager:
    • Form class is changed
    • Unit name is changed
    • File name is changed
  • Through Property Inspector:
    • Form class is changed
    • Unit name is NOT changed
    • File name is NOT changed

Should I make both behave the same way or do you guys see an advantage in these behaving differently? Please let me know.

Share this post


Link to post
Share on other sites

This behaviour is not limited to Forms but to other classes as well 

For example: Looking at the 'unit structure' tab with the SmartCL.Borders unit open, I can rename the TW3Border class to something else

For Forms I don't see any advantage of changing a form class and not change the unit and filename, but for other object classes changing the class name only is somewhat handy

(although a search and replace old/new classname will have the same effect)

Share this post


Link to post
Share on other sites

> Through Project manager:  Through Property Inspector

I think SMS in this should behave as Delphi.

Project manager operates on units, so it will display unit name (for example MainForm.pas) and renaming there, renames unit.

Object/Property inspector operates on components, so changing form name just does that, changes form name and class, unit is unaffected.

For forms units I do like to have a different unit name and a different form name, for example I prefix all controls with it's type abbreviation, something like:
 

Unit: 
SettingsForm.pas
	FormControl: frmSettings
   		Panel: pnlMain
      		ListBox: lbItems
   		Panel: pnlRight
			ListBox: lbCategories
		Panel: pnlBottom
			Button: btnOK
			Button: btnCancel

 

 

Share this post


Link to post
Share on other sites

Thank you for your comments. @IgorSavkic's suggestion makes perfect sense. To sum this up:

  • Rename from Project Manager:
    • Change unit name
    • Change file name
    • NO changes to form class name
  • Rename from Property Inspector:
    • Change form class name
    • NO changes to unit name
    • NO changes to file name

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×