Modify

Opened 17 years ago

Closed 17 years ago

#1099 closed Bug (No Bug)

The GUICtrlSetPos() function redraws each draw when moving a graphic

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.3.0.0 Severity: None
Keywords: GUICtrlSetPos(), move graphic, performance Cc:

Description

The GUICtrlSetPos() function redraws each drawn line,etc. when moving a graphic, rather than just moving the final resulting graphic, this causes the function to take increasingly long time to execute for graphics which needs updating.

example code to simulate the problem:

; Script to simulate a bug in Autoit.
#include <GUIConstantsEx.au3>

AdlibEnable("GUIUpdate",20)

GUICreate("THIS IS A TEST",400,400)
GUICtrlCreateGraphic(10,10,380,380)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetColor(-1,0)
Global $box=GUICtrlCreateGraphic(20,20,20,20)
GUISetState(@SW_SHOW)
Sleep(3000)



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

GUIDelete()

Func GUIUpdate()
	AdlibDisable()
	GUICtrlSetGraphic($box,$GUI_GR_PENSIZE,2)
	GUICtrlSetGraphic($box, $GUI_GR_COLOR,0,0xc0c0ff)
	GUICtrlSetGraphic($box,$GUI_GR_RECT,1,1,18,18)
	GUICtrlSetGraphic($box,$GUI_GR_PENSIZE,2)
	GUICtrlSetGraphic($box,$GUI_GR_COLOR,0xff0000,0x00ffff)
	GUICtrlSetGraphic($box,$GUI_GR_RECT,1,1,18,18)
	Local $time=TimerInit()
	GUICtrlSetPos($box,Random(10,360,1),Random(10,360,1))
	$time=TimerDiff($time)
	ToolTip("TimeTaken: "&$time)
	AdlibEnable("GUIUpdate",20)
EndFunc

Attachments (0)

Change History (2)

comment:1 by ankitstr, 17 years ago

I am having this problem and can't continue with my project as the project requires constant updating and moving of a number of graphics, hence, taking up all the CPU, gradually slowing down the graphics and finally, stopping.

comment:2 by J-Paul Mesnage, 17 years ago

Resolution: No Bug
Status: newclosed

You are creating too many drawing as you always add.
Just recreate the drawing in your adlib.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


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