Modify

Opened 10 years ago

Closed 10 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 Changed 10 years ago by ankitstr

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 Changed 10 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

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

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

Action
as closed The ticket will remain with no owner.
Author


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

 
Note: See TracTickets for help on using tickets.