Jump to content

It seems a bug in the function _ChooseFont


AndreyS
 Share

Recommended Posts

Try running the example from the help file and select the font color olive. In the next dialog, it will have turquoise. This happens with some other colors.

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

Local $a_vFont = _ChooseFont()

Local $sFontName = $a_vFont[2]
Local $iFontSize = $a_vFont[3]
Local $iColorRef = $a_vFont[5]
Local $iFontWeight = $a_vFont[4]
Local $bItalic = BitAND($a_vFont[1], 2)
Local $bUnderline = BitAND($a_vFont[1], 4)
Local $bStrikethru = BitAND($a_vFont[1], 8)
$a_vFont = _ChooseFont($sFontName, $iFontSize, $iColorRef, $iFontWeight, $bItalic, $bUnderline, $bStrikethru)
If (@error) Then
    MsgBox($MB_SYSTEMMODAL, "", "Error _ChooseFont: " & @error)
Else
    MsgBox($MB_SYSTEMMODAL, "", "Font Name: " & $a_vFont[2] & @CRLF & "Size: " & $a_vFont[3] & @CRLF & "Weight: " & $a_vFont[4] & @CRLF & "COLORREF rgbColors: " & $a_vFont[5] & @CRLF & "Hex BGR Color: " & $a_vFont[6] & @CRLF & "Hex RGB Color: " & $a_vFont[7])
EndIf

Autoit: 3.3.14.2. Windows: 8.1.

How to fix it?

Link to comment
Share on other sites

1 hour ago, AndreyS said:

How to fix it?

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

Local $a_vFont = _ChooseFont()

Local $sFontName = $a_vFont[2]
Local $iFontSize = $a_vFont[3]
Local $iColorRef = $a_vFont[7]
Local $iFontWeight = $a_vFont[4]
Local $bItalic = BitAND($a_vFont[1], 2)
Local $bUnderline = BitAND($a_vFont[1], 4)
Local $bStrikethru = BitAND($a_vFont[1], 8)
$a_vFont = _ChooseFont($sFontName, $iFontSize, $iColorRef)
If (@error) Then
    MsgBox($MB_SYSTEMMODAL, "", "Error _ChooseFont: " & @error)
Else
    MsgBox($MB_SYSTEMMODAL, "", "Font Name: " & $a_vFont[2] & @CRLF & "Size: " & $a_vFont[3] & @CRLF & "Weight: " & $a_vFont[4] & @CRLF & "COLORREF rgbColors: " & $a_vFont[5] & @CRLF & "Hex BGR Color: " & $a_vFont[6] & @CRLF & "Hex RGB Color: " & $a_vFont[7])
EndIf

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I was looking for a more suitable, but not found. Tell me, please, in the future.

But the problem is not really in the documentation, so as soon as this function to work properly as in the example. Apparently with the release of a new version Autoit something changed.

Edited by AndreyS
Link to comment
Share on other sites

Maybe it went from RGB to BGR.

Only toiling through the changelog will tell.

Or someone smarter than I. But the documentation is poor for that function.

I'm unsure but I hope your immediate need is satisfied.

OAO

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...