Forum > Packages and Libraries

SpkToolbar + High color 16-bit

(1/2) > >>

dseligo:
I had hard to track problem with SpkToolbar: program was crashing without showing any error when starting on one computer.
Problem was with form that has SpkToolbar on it and it was created in .lpr.
After commenting this form creation in .lpr and trying to create form with SpkToolbar after showing main form I finally got an error: TSpkGUITools.DrawAARoundCorner: Bitmapa musi bya w trybie 24-bitowym!.
OS was Windows 7 64-bit, with color depth set to 16 bit.
After I changed color depth to 32 bit problem went away.

Error is raised in SpkGUITools.pas at the beginning of the DrawAARoundCorner procedure:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  if ABitmap.PixelFormat <> pf24bit then    raise Exception.Create('TSpkGUITools.DrawAARoundCorner: Bitmapa musi byƦ w trybie 24-bitowym!');
I created two projects (attached) which show the problem and recreated problem in Windows 7 32-bit in virtual machine.
In first project form with SpkToolbar is auto-created and program just dies and in second project I put SpkToolbar in second form. This is error from second project:

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---[Window Title]project2 [Content]TSpkGUITools.DrawAARoundCorner: Bitmapa musi bya w trybie 24-bitowym!. Press OK to ignore and risk data corruption.Press Abort to kill the program. [OK] [Abort]
Is this known error?
How can I detect color depth in Windows (to prevent silent crash)?

wp:
This exception is raised at the beginning of several routines within the SpkGuiTools unit (in the one that you refer to, I had forgotten to replace the Polish comment...). This looks as if 24bit bitmaps are essential to this library. Looking at the code, however, I do not see any low-level function with need this. Maybe a left-over of some ancient Delphi version? Therefore, I would experiment with removing this restriction. But now my REAL problem: How do I switch Windows to 16-bit colors? My Windows-11 only lists 32-bit color modes.

Played with the compatibility settings of your test projects and switches these programs to 16-bit, and even to 8-bit modes, but no error.

dseligo:

--- Quote from: wp on November 11, 2022, 02:48:27 pm ---How do I switch Windows to 16-bit colors?

--- End quote ---

In Windows 10: right click on desktop, Display Settings, Advanced Display Settings, Display Adapter Properities for Display 1, 'List All Modes' button.

If you don't have any mode that is 16-bit, then driver doesn't support it anymore (on my laptop I tried with compatibility settings but I couldn't replicate problem).
Problem occured on computer with Windows 7 installed, and I replicated it in Windows 7 VM (Hyper-V).

wp:
I only have 32-bit modes, both in the native Win-11 and in the virtual Win-7 (VirtualBox). However, when I run the SpkToolbar BasicDemo in a Linux-VM as gtk3 application I get the same error that you are reporting.

As I already wrote I do not see a real reason for the limitation to 24-bit pixels I deleted all occurrencies of pf24Bit, i.e. lines like "if ABitmap.PixelFormat <> pf24Bit then raise Exception.Create(...)". There are about 10-20 such lines in the unit SpkGUITools. There are two more in SpkToolbar.pas (assignment of pf24Bit to bitmap.PixelFormat). Simply search for "24bit" in these two units and delete the found lines (plus the "raise Exception..." which is always in the following line). After recompilation of the package the error did no longer show in the gtk3 application. (gtk3 has many other problems, therefore I am not concerned that mouse clicks and mouse-over effects are not working here.)

Doing the same with win32, gtk2, qt, cocoa, I don't see any negative effects. So, please test your Windows with 16-bit colors, and verify that this solved the issue there, too.

dseligo:

--- Quote from: wp on November 11, 2022, 05:10:04 pm ---So, please test your Windows with 16-bit colors, and verify that this solved the issue there, too.

--- End quote ---

I tried in Windows 7 16-bit color depth and it is working now, thank you.

Navigation

[0] Message Index

[#] Next page

Go to full version