Jump to content

Time to refresh a GUI is too long ! I see the flickering. [SOLVED]


Jikoo
 Share

Recommended Posts

Hello,

Today, I will be critical ! :)

I would like to talk about the time to refresh a window is too long when I resize it (using mouse on bottom right corner). Why ?

I tested MSpaint and Notepad on XP SP2, it's the same thing !... but not with Wordpad, Internet Explorer, VLC, Mozilla Firefox and most of programs.

Why AutoIt use an "old" method to refresh GUI when I resize it ? :mellow:

Why AutoIt redraw all controls after each resizing ? :(

Is it the same thing on VISTA ?

A basic script. Use mouse on bottom right corner to resize the GUI and play with the resizing GUI.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Local $msg

GUICreate("My GUI", 200, 200, -1, -1, $WS_OVERLAPPEDWINDOW)

GUICtrlCreateListView("Demo", 10, 10, 180, 160)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete()
Edited by Jikoo
My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

I just tested your script on my XP SP3 box, and resizing was instantaneous.

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

Thanks Airwolf,

Not for me. :mellow: For example, I see a difference between Notepad and Worpad resizing on XP SP2 ! Same difference between AutoIt compiled script and VLC !

It's not instantaneous for Notepad and AutoIt compiled script because all controls are redraw, not on Wordpad and VLC. Sure, methods of resizing are different.

Edited by Jikoo
My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

Yes youknowwho4eva, :mellow:

That's what I am talking about : the flickering. Add Sleep(100) in the main loop is not the best solution ! ...And using of @SW_LOCK/@SW_UNLOCK is not easy for GUI resizing.

Edited by Jikoo
My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

The problem is known long time ago. Look at here

A good example of this problem

Edited by Jikoo
My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

youknowwho4eva,

It could be a solution. Do you think it's possible to use this method with Opt("GUIOnEventMode", 0) ;0=disabled, 1=OnEvent mode enabled because my program have more than 2000 lines !!! :mellow:

Edited by Jikoo
My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

I found the solution here.

Use the extended window style $WS_EX_COMPOSITED and the flickering will go away.

Const $WS_EX_COMPOSITED = 0x2000000

My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

A simple example done by myself : (No disco-club flickering ! :mellow: )

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

Global Const $WS_EX_COMPOSITED = 0x2000000
Global $msg
Global $GUI = GUICreate("My GUI", 200, 200, -1, -1, $WS_OVERLAPPEDWINDOW, $WS_EX_COMPOSITED)
Global $lv = GUICtrlCreateListView("Demo", 10, 10, 180, 160, BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_NOCOLUMNHEADER))
Global $hLV = ControlGetHandle($GUI, "", $lv)

For $y = 0 to 10
    _GUICtrlListView_AddItem($hLV, "Item : " & $y)
Next

_GUICtrlListView_SetColumnWidth($hLV, 0, $LVSCW_AUTOSIZE)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete()
Edited by Jikoo
My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
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...