Modify

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#2823 closed Bug (Completed)

_ChooseFont default color

Reported by: careca777 Owned by: Melba23
Milestone: 3.3.13.15 Component: AutoIt
Version: 3.3.12.0 Severity: None
Keywords: Cc:

Description

It says the default color is in RGB format, but it's BGR Color.
Following example shows this, select marron color, RGB 0x800000,
This RGB result is used in the next _ChooseFont which should open with the same color, but doesn't, it opens with navy blue, which is RGB 0x000080 OR BGR 0x800000!

All there is to do is change in the help file parameter:
"$iColorRef [optional] COLORREF rgbColors" to BRG colors, or fix the parameter to accept RGB.

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $a_font = _ChooseFont("Arial", 8)
MsgBox($MB_SYSTEMMODAL, "", "Hex BGR Color: " & $a_font[6] & @CRLF & "Hex RGB Color: " & $a_font[7])
$ChosenColor = $a_font[7]
Local $a_font = _ChooseFont("Arial", 8, $ChosenColor)

Attachments (0)

Change History (4)

comment:1 by Melba23, 12 years ago

Milestone: 3.3.13.15
Owner: set to Melba23
Resolution: Fixed
Status: newclosed

Fixed by revision [10606] in version: 3.3.13.15

comment:2 by Melba23, 12 years ago

The UDF function has been modified to convert the $iColorRef parameter from RGB to BGR so the Help file is now correct.

M23

comment:3 by Melba23, 12 years ago

Resolution: FixedCompleted

Added by revision [10613] in version: 3.3.13.15

comment:4 by BrunoJ, 11 years ago

The fix applied did work for the input, but that was not the whole problem. The help states that element 5 of the return array is "COLORREF rgbColors". The value returned is actually BRG. Here is a suggested new line shown below in it's placement just before the last line:

	$iColorRef = BitOR(BitShift(BitAND($iColorRef, 0x000000FF), -16), BitAND($iColorRef, 0x0000FF00), BitShift(BitAND($iColorRef, 0x00FF0000), 16))
	Return StringSplit($iAttributes & "," & $sFaceName & "," & $iSize & "," & $iWeight & "," & $iColorRef & "," & '0x' & $sColor_picked & "," & '0x' & StringMid($sColor_picked, 5, 2) & StringMid($sColor_picked, 3, 2) & StringMid($sColor_picked, 1, 2), ",")

Also, the tag structure should be changed to reflect "bgrColors" instead of "rgbColors". Of course, this change will not affect operation. However, it will help avoid confusion when reading the code.

Modify Ticket

Action
as closed The owner will remain Melba23.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.