Jump to content
Sign in to follow this  
enaiman

$WS_EX_COMPOSITED bug?

Recommended Posts

enaiman

I don't know why this is happening but I've noticed that the above style is messing up a few things:

- ListWiew controls disapears

- if a label is used as a Group control text, when this style is applied the label will show as being "under" the group control (you can see the border of the group through the label.

Anyone has an idea why this is happening? and if there is any way to fix it?

I'm running AutoIt 3.3.0.0 on WinXP

Here is a sample code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Const $WS_EX_COMPOSITED = 0x2000000
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 400, 394, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$ListView1 = GUICtrlCreateListView("", 16, 16, 361, 121, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES))
$ListView1_0 = GUICtrlCreateListViewItem("1|11|12|13", $ListView1)
GUICtrlCreateGroup("", 16, 150, 361, 200)
GUICtrlCreateLabel("Group Name", 25, 148)
$Button1 = GUICtrlCreateButton("Apply Style", 160, 358, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
WEnd

Func Button1Click()
    GUISetStyle(-1, $WS_EX_COMPOSITED, $Form1)
EndFunc
Func Form1Close()
    Exit
EndFunc

Thanks,


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
KaFu

- if a label is used as a Group control text, when this style is applied the label will show as being "under" the group control (you can see the border of the group through the label.

Help-File: "$WS_EX_COMPOSITED = Windows XP or above: Paints all descendants of a window in bottom-to-top painting order using double-buffering."... the painting order is reversed, that's why controls in the foreground suddenly switch to the background. Style also works on Vista and Win7 only if Aero is disabled (search example forum on WS_EX_COMPOSITED, I got a sample somewhere there floating around). Regarding the listview.... I don't know why it behaves like this too :idea:...

Share this post


Link to post
Share on other sites
enaiman

@KaFu

Thanks for explanation - that fully answers the question related to the label (been experimenting a little creating the label before and after the group and seen the results). That doesn't hurt too much; what it does hurt is the ListView.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
wraithdu

Don't set the extended style from within GuiCtrlCreateListView. Create the listview, then set the extended style with _GuiCtrlListView_SetExtendedStyle. It's a long standing bug or something.

Edited by wraithdu

Share this post


Link to post
Share on other sites
KaFu

Don't set the extended style from within GuiCtrlCreateListView. Create the listview, then set the extended style with _GuiCtrlListView_SetExtendedStyle. It's a long standing bug or something.

Hu, tried that, but it seems to make the listview disappear completely on switch.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListview.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
;Const $WS_EX_COMPOSITED = 0x2000000
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 400, 394, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$ListView1 = GUICtrlCreateListView("", 16, 16, 361, 121)
GUICtrlSetBkColor(-1,0x00ff00)
_GUICtrlListView_SetExtendedListViewStyle($ListView1,BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES))
$ListView1_0 = GUICtrlCreateListViewItem("1|11|12|13", $ListView1)
GUICtrlCreateGroup("", 16, 150, 361, 200)
GUICtrlSetBkColor(-1,0x00ff00)
GUICtrlCreateLabel("Group Name", 25, 148)
GUICtrlSetBkColor(-1,0x00ff00)
$Button1 = GUICtrlCreateButton("Apply Style", 160, 358, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
WEnd

Func Button1Click()
    GUISetStyle(-1, $WS_EX_COMPOSITED, $Form1)
EndFunc
Func Form1Close()
    Exit
EndFunc

Share this post


Link to post
Share on other sites
martin

WS_EX_COMPOSITED and list views do not mix. I think it's a widows listview problem, but anyway it's a problem that has irritated may people including me.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
enaiman

Thank you all for your help.

I thought there was something wrong with my code/AutoIt version. I'll have to "be happy" with what I have :idea:


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
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
Sign in to follow this  

×