Opened 9 years ago

Closed 8 years ago

#2945 closed Bug (Fixed)

Center and right justified text broken on native buttons when colours set

Reported by: AlanParry Owned by: Jon
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:



After upgrading my scripts from to it appears that center and right justification of native buttons aren't working properly now when either

i) GUICtrlSetDefColor or GUICtrlSetDefBkColor called before a button wiht aligned text is created

ii) GUICtrlSetColor or GUICtrlSetBkColor is called after the text alignment has been set.

An alternate problem is: if the alignment is set using GUICtrlSetStyle after the colour has been set then the colours settings are lost (but the alignment is then correct).
(Note also:- Strangely after loosing set default colours with a style change, setting just the background colour restores the foreground colour as well, as can be seen in the last set of examples).

The problems occur on and Slightly different but similar issues occurred in 3 3.8.1. My suspicion is that it that it might be related to the bug fix for #2299 at milestone
In Left and Right alignment were wrong but center was correct.

The permutations of: default color settings; alignment at creation; style changes; and color changes effect the issue in different ways. So I have attached a script that shows the permutations and labels those which are wrong.

Without wishing to state the obvious I wonder if the values used by MS for alignments are causing any confusion as


so simple bit tests don't always do what expected.

Alan Parry

Attachments (1)

ButtonTextJustify.au3 (2.5 KB) - added by AlanParry 9 years ago.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by AlanParry

comment:1 Changed 9 years ago by Jpm

You win the price of the better repro script.
Seriously I have a look

comment:2 Changed 9 years ago by AlanParry

Thanks - I think!

I was was getting confused with all the cases and versions - building a table of all the cases made it much clearer for me.

Its 2 problems I think:

i) The Owner draw routines for native buttons that is used for coloured buttons gets the bit testing of the alignment wrong.

ii) When GUICtrlSetStyle is called on a button that is owner-draw to change the alignment, the button stops being owner-draw.

Thanks for looking
Alan Parry

comment:3 Changed 9 years ago by Jpm

I fix the problem.
A fix has been sent to Jon for integration

Thanks the error was due to the coloring

comment:4 Changed 9 years ago by AlanParry

Amazing response time: reported and fixed in 24 hours - I look forward to the next release

Alan Parry

comment:5 Changed 8 years ago by Jon

  • Milestone set to
  • Owner set to Jon
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [11408] in version:

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Jon.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.