Modify

#2945 closed Bug (Fixed)

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

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

Description

Hi,

After upgrading my scripts from 3.3.8.1 to 3.3.12.0/3.3.13.19 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 3.3.12.0 and 3.3.13.19. 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 3.3.9.21.
In 3.3.8.1 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

BS_CENTER = BitOR(BS_LEFT, BS_RIGHT)

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

Regards
Alan Parry

Attachments (1)

ButtonTextJustify.au3 (2.5 KB ) - added by AlanParry on Nov 24, 2014 at 7:09:15 PM.

Download all attachments as: .zip

Change History (6)

comment:1 by Jpm, on Nov 25, 2014 at 9:18:21 AM

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

comment:2 by AlanParry, on Nov 25, 2014 at 11:25:37 AM

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 by Jpm, on Nov 25, 2014 at 5:43:46 PM

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

Thanks the error was due to the coloring

comment:4 by AlanParry, on Nov 25, 2014 at 6:00:21 PM

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

Thanks
Alan Parry

comment:5 by Jon, on Jul 14, 2015 at 11:57:13 AM

Milestone: 3.3.15.0
Owner: set to Jon
Resolution: Fixed
Status: newclosed

Fixed by revision [11408] in version: 3.3.15.0

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


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