[Gambas-user] Overflow Errors with Gambas 3.18 and Master

Benoit Minisini benoit.minisini at gambas-basic.org
Sat Jan 14 00:20:33 CET 2023


Le 14/01/2023 à 00:11, Claus Dietrich a écrit :
> Am 13.01.23 um 22:29 schrieb Benoit Minisini:
>>> The crash occurs in this line, where the background color of the 
>>> clockface is set :
>>>
>>> Paint.Brush = Paint.Color(ClockFaceColor + 16777216 * ClockFaceOpacity).
>>>
>>> At the point of crash ClockFaceColor=4210752 and ClockfaceOpacity is 
>>> 128. The resulting hex color is 80404040. Actually it should be 
>>> usabel up to FF404040 for a maximum opacity which I normally use for 
>>> my Desktop clock. A bug? Could the error message received by my 
>>> friend have the same background?
>>
>> The previous IDE was generating incorrect code that overflows for 
>> colors. Normally if you recompile the project, it should be 
>> automatically fixed. 
> 
> The error occurs in the previously compiled version but also during 
> development time in the up-to-date IDE.
> 
> Claus
> 

Sorry, I didn't read carefully enough (again).

ClockFaceColor + 16777216 * ClockFaceOpacity -> This is the code that 
overflows.

You must replace this wrong code by:

Color.SetAlpha(ClockFaceColor, ...)

Regards,

-- 
Benoît Minisini.



More information about the User mailing list