Ted Lyngmo wrote:
I created a BITMAP (24x24x16 indexed colors) icon for my component
back in 2002 (BCB4).
Modern versions of the IDE support multiple image sizes (16x16, 24x24,
32x32, and 128x128) and multiple color depths (16bit, 24bit, and
32bit). And 10.2.2 Tokyo even adds support for PNGs!
I used the Image Editor to This works fine in BCB4 and RAD2007 but I
can't figure out how to make it work properly in 10.2.
The exact same way as before. The old method still works.
That's good! Something must have gone wrong when I copied the project from BCB4 to RAD2007 and then from RAD2007 to 10.2 since the bitmap in the existing .res file only appeared in 2 out of 4 places in the 10.2 IDE.
We just don't have the Borland Image Editor anymore,
I still use the editor from BCB4. It matches my graphical skills perfectly.
but any graphics editor will work. And you can compile .res files
using .rc files with BRCC32.EXE.
[...]
Then you didn't compile your images into your component's package
correctly.
Indeed.
I removed all traces of the loose bitmap variants from the project and then added the original resource file again but this time via the "Project Manager" (instead of via "Resources and Images..."):
"Contains\Add..."
"Unit file name: TComPort.res"
Compiled and installed - and now it works!
Edit: I take that back. After having removed it and tried misc. other ways, I can't get it to work like I did above again...
sigh
Edit2: No icon was shown in any of the four placed it was shown before. I then just restarted the IDE and there it was - but this time only on the Component bar and on the forms which is the opposite to what made me start this thread. What made it appear to work for a while may have been some glitch in the IDE. I didn't restart to see if the Icon was still visible. :-/
Edit3: The "LynconComPort_resources.rc" with a reference to TComPort.bmp was still present in the directory even after I removed the bmp file from the project (and then removed the bmp from the directory). I now deleted that rc file, recompiled and installed and now it's visible everywhere again. This time I restarted the IDE to check - and now the Icon is gone again. Another noticeable thing that it's not showing up in the list of Installed Packages anymore (it did previously).
Edit4: I noticed the compiler had stopped creating new object files (or only did it occasionally) so when I changed something it didn't have an immediate effect. The linker happily linked the old versions. I ran the compilation command from command prompt and it was successful ... but the file wasn't updated. I removed the object file and ran the command and again, successful - but no obj file. I
think that it was when I unticked "C++ Compiler\Pre-compiled Headers\External type files (Clang compiler)" that I got the object file generation going again and then I added the bmp file and it now looks like it's working.
On the subject of header files: When using my component in a project, the header file can't be found. $(BDSCOMMONDIR)\hpp\$(Platform) is empty. What do I need to do to get it installed so it can be used directly (like the lib etc)?
The .res file is added but doesn't show up if I go into "Project
\Resources and Images" again. Also, when adding it, it pre-selected
type RCDATA, so I stuck with that and changed the Resource Identifier
to "TComPort".
This is all wrong. If you are going to use the dialog to manage teh
.res file (I prefer using .rc files instead), then add your 24x24
image, give it the BITMAP type, and "TCOMPORT" identifier. DO NOT add
the .res file itself!
Got it!
Did you add a "128" suffix to the resource identifier ("TCOMPORT128")?
You need a separate resource for each image size ("TCOMPORT16" for
16x16, "TCOMPORT" for 24x24, "TCOMPORT32" for 32x32, "TCOMPORT128" for
128x128) that you want to support.
I didn't see that part in the guide I tried to follow, but now when you mention it, it's right there in the other guide I found. I did however try with the original TComPort.bmp (24x24) with the resource id TCOMPORT too.
When compiling, the package's .rc file (that has been created automatically by the IDE when I added the .bmp file I guess) is compiled
c:\program files\embarcadero\studio\19.0\bin\cgrc.exe -c65001 "LynconComPort_resources.rc" -fo.\Win32\Release\LynconComPort_resources.res
It contains:
TCOMPORT BITMAP "TComPort.bmp"
"CGRC.EXE is the compiler-binder that is called by the IDE when you have selected to use the Windows SDK Resource Compiler"
I haven't selected the Windows SDK Resource Compiler - and in Project\Options\Resource Compiler it says brcc32.exe. That's odd ...
Should there be an .rc file called TComPort.rc for it to work? If so, do I need to create that one manually and add it to the project?
So far, creating the .res file using BCB4's editor have been the only thing working - once I figured out how to add it to the project that is.
Correct. If you don't provide an image of a certain size, the IDE will
simply resize one of the images that you do provide. The IDE has
always done that.
Great!
Thanks! / Ted
Edited by: Ted Lyngmo on Feb 1, 2018 4:28 PM
Connect with Us