Showing posts with label Embarcadero RAD Studio. Show all posts
Showing posts with label Embarcadero RAD Studio. Show all posts

Thursday, October 1, 2015

Error Creating Form: Ancestor for 'TFormName' Not Found

So, this one has been bugging me for a while. I'm using Embarcadero's RAD Studio 10 Seattle, working on a sizable C++ application. For a few specific units, whenever I load them, I get the following message:
Error creating form: Ancestor for 'TFormName' not found.
(Of course, it actually said the name of my form, not 'TFormName'.)

And when this happens, my .dfm (Delphi Form) won't load, so I can't do anything with the design of that particular form. To work around this, I had to open the ancestor (or in at least one case, multiple ancestors), and leave them open in the IDE, before being able to view my form's .dfm at all.

So I double-checked all my include and lib paths, as well as my include statements in the headers of my .h files. I googled my fingers to the bone, looking for any answer I could find. Nothing.

Finally, I noticed that the form I was trying to inherit from wasn't even in the inheritable items list, which led me to this old post, and I knew I'd found the culprit.

In the end, the solution was spectacularly simple: Remove all problematic units from the project. Then, add them back in the appropriate order. No more error!

It really was as simple as this:

Friday, August 15, 2014

Solved: Unable to open file 'FIREDAC.STAN.FACTORY.OBJ'

Today, I kept getting this error in Embarcadero C++ Builder XE6 when trying to compile a pretty large project:
[ilink32 Error] Fatal: Unable to open file 'FIREDAC.STAN.FACTORY.OBJ'
My project referred to a library that had FireDAC components, though I wasn't using any of them. My project uses DBX, not FireDAC, and VCL instead of FMX.

FireDAC.lib was in the project includes in my .cbproj file, so I had no idea what was wrong.

I finally found a fix: drop a FireDAC component (I used FDConnection) on a form. Save all, compile, and it worked. Then, I just deleted the FDConnection from the form and I was good to go.

Wednesday, July 16, 2014

Changing Fire Monkey (FMX) TextSettings at Run Time

One of my beefs with Embarcadero's C++ Builder is that it is so hard to find decent documentation or tutorials on how to do even the simplest things with their visual tools. This is especially true if you're developing in C++ instead of Delphi.

I experienced a pretty steep learning curve with Embarcadero's Visual Class Library (VCL) -- not because it is especially complicated, but because I couldn't find much good documentation for it.

Right now, I am building an FMX application, which is similar in a lot of ways to VCL. However, one thing has changed a lot: the styles are now driven by stylesheets.

For example, in VCL, it was relatively easy to change the font attributes of dynamically created elements at run time. Not so with FMX.

After several hours of fruitless googling, I still haven't figured out how to change my StyleLookup for a dynamically created TEdit. My custom style works fine for controls created at design time, but I'm apparently missing something from the picture.

After some trial and error, I did manage to come up with a solution that pretty closely replicates how text formatting worked in VCL. This obviously isn't ideal, but at this point, I will take what I can get and be happy to move on. The trick is to turn off the FontColor in your object's StyledSettings.


//Make ValueLabel to display output
TLabel * ValueLabel = new TLabel( this );
ValueLabel->Parent = VerifyMappingsScrollBox;
ValueLabel->Position->X = ValueLabelLeft;
ValueLabel->Position->Y = LabelTop;
ValueLabel->Width = ValueLabelWidth;
if ( OutputValue.Length() == 0 )
{
//Turn it light gray if empty
  ValueLabel->StyledSettings = ValueLabel->StyledSettings >> TStyledSetting::FontColor;
  ValueLabel->TextSettings->FontColor = claLightgray;
  ValueLabel->Text = "Empty";
}
else
{
  ValueLabel->Text = OutputValue;
}



So far, I'm not too impressed with the FMX framework. It does some cool things, but some elements are so buggy and counter-intuitive that it's easy to see why no one is making new documentation or tutorials for it. Which is a bummer for those of us who are obligated to use it for the foreseeable future.

Monday, January 13, 2014

Embarcadero RAD Studio: VCL Tutorial

I'm not sure why, but I had a hard time finding beginner-level tutorials on how to create VCL forms applications in Embarcadero's RAD Studio. After a lot of googling and some poking around, I found this one, which was more helpful than anything else I've encountered yet:

Starting your first RAD Studio application Index (IDE Tutorial) - RAD Studio:

Does anyone else know of tutorials that would be helpful for a beginner trying to learn about VCL forms in RAD / C++ Builder?