Recent

Author Topic: *SOLVED* TPageControl changes some captions (but not all)!  (Read 1225 times)

tfurnivall

  • Jr. Member
  • **
  • Posts: 80
*SOLVED* TPageControl changes some captions (but not all)!
« on: July 27, 2025, 12:42:11 am »
I recently returned to this project (attached) and noticed some strange behavior. The TPage control has 10 pages, captioned and named as follows:

Paint               pgPaint
Toolbox           pgPaintToolbox
Widgets          pgWidgets
Toolbox           pgWidgetToolbox
Controls          pgControls
Toolbox           pgControlToolbox
Config             pgConfig
Options           pgOptions
Environment    pgEnvironment
Tools              pgTools

The pages captions Toolbox are all designed invisible, as is the Options page.

When I compile and run the program the invisible pages are suitably invisible.
However, the first three visible pages (Paint, Widgets, Controls) have changed captions Page 0, Page 1, Page 2.
The last pages (Config, Environment, Tools) all show the correct captions.

The form is copied in from a Model form, and I added the first 6 pages today.

I must have done something wrong, somewhere, bu I have no idea what.

Any ideas and suggestions (including RTFM if the FM is named) gratefully received.

Thanks,

Tony
« Last Edit: July 27, 2025, 04:45:29 am by tfurnivall »

jamie

  • Hero Member
  • *****
  • Posts: 7303
Re: TPageControl changes some captions (but not all)!
« Reply #1 on: July 27, 2025, 03:08:59 am »
I was able to get it to work however, not without some pain.

You made a copy of your Modelform.pas inside the component folder along with the lfm file and the ide was going for that wrong one.

 So, your required packages also had a copy of the modelform.pas and the lfm file which was getting changed there but at compile time, you were getting the lfm file in the main folder.

I am sure this isn't your actual code you presented here.

 I opened the xmls file where the settings are for the project and down where the required packages are I removed the sub directory as the target it for the modelform.pas and lfm file , I also deleted that folder.

 I had to open the project via the modelForm.pas along with opening the prj file to get things working again

 it now shows the Page 0, 1, 2 etc on the designer and you can change it.

 
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 7303
Re: TPageControl changes some captions (but not all)!
« Reply #2 on: July 27, 2025, 03:39:05 am »
Attached is a working example.



The only true wisdom is knowing you know nothing

tfurnivall

  • Jr. Member
  • **
  • Posts: 80
Re: TPageControl changes some captions (but not all)!
« Reply #3 on: July 27, 2025, 04:45:02 am »
Thanks, Jamie,

I'm still grappling with the whole concept of Projects etc, and so I don't really know where I went wrong!

AFAICR I copied the contents of a folder called SDL Model Application into a new folder, and then worked with the copy. Yes - it was the exact code with which I was working, but somewhere along the way I copied in (or referenced perhaps) the original ModelForm which was in the components of SDL Model Application.

Is there a really good reference and learning tool to explain the whole project thing?

(You can see my ancient roots in COBOL and that type of environment showing, I suspect),

Thanks, again, for your response and explanation,

Tony

tfurnivall

  • Jr. Member
  • **
  • Posts: 80
Re: *SOLVED* TPageControl changes some captions (but not all)!
« Reply #4 on: July 27, 2025, 11:00:51 pm »
Follow up to Jamie's message. (Mostly stream-of-consciousness as I explore the Project and Lazarus structures).

So I went to look at the .lpi file (using Notepad++):
Quote
    <Units>
      <Unit>
        <Filename Value="GraphicsWorkbench.lpr"/>
        <IsPartOfProject Value="True"/>
      </Unit>
      <Unit>
        <Filename Value="..\_Components\SDLModelApp\modelform.pas"/>
        <IsPartOfProject Value="True"/>
        <ComponentName Value="SDLModelForm"/>
        <HasResources Value="True"/>
        <ResourceBaseClass Value="Form"/>
        <UnitName Value="ModelForm"/>
      </Unit>
    </Units>

The filename associated with SDLModelApp wasn't in the Components directory of my project, then I remembered ".." = parent directory. And that would be parent directory of the directory where the project is (not where the published zip file is). So for:

Quote
      <DestinationDirectory Value="F:\Software Development\Lazarus Projects\GRAPHICS WORKBENCH\Published For Export"/>
this would be parent directory of  F:\Software Development\Lazarus Projects\GRAPHICS WORKBENCH
or
F:\Software Development\Lazarus Projects

Ahah! There is a components folder there, and there is a folder called SDLModelApp which contains mirabile dictu files called modelform.lfm and modelform.pas. Even more mirabile, their last modified time was today, whereas the files in Graphics Workbench were last modified almost a week ago. This meant that all of the work I thought I had been doing was on the files in SDLModelApp, rather than Graphics Workbench.

(Which is, of course, exactly what you said!).

Now - believing that Lazarus, while it might take umbrage at what I was about to do, lacked the ability to respond in any meaningfully destructive way, I tried to accomplish what I wanted, which was to get the file from the wrong location, containing all the right data, into the right location. Rename modelform.* to OLD_modelform.*, and copy in the files from the 'wrong' location.

No smoke so far.

Now I need to change the .lps file to point to the 'right' location, which involved deleting the extended pathname many times.

Feeling somewhat like a neurosurgical resident on his first day - with a blinding hangover, I tried restarting Lazarus, using the .lpr file...

It opens properly, and I see the write captions, but when I compile, it still comes back Page0, et al.

Then, I went back into the 'wrong' directory, and renamed modelform.* to WRONG_modelform.* No way the IDE or the compiler will find those!

Eventually I got the write form file associated with the project. Lesson to myself - learn how the IDE goes after all the components of a project, and see how to discover where this information is stored.

Thanks, again, Jamie!

 

TinyPortal © 2005-2018