Modify

Opened 15 years ago

Closed 15 years ago

#774 closed Bug (Fixed)

GUICtrlSetBkColor delayed mishap.(Labels turn White)

Reported by: MvGulik Owned by: Jpm
Milestone: 3.3.1.0 Component: AutoIt
Version: 3.3.0.0 Severity: None
Keywords: GUICtrlSetBkColor Cc:

Description

following code displays a window with a 10x10 label grid.
while running, the label's background color is continus changed (random label + random color)
after running for some time, all labels turn white.
ps: move mouse around to speed things up. (~15x Faster)+(mishap after ~5sec/2.4Mhz)
Also when the labels are white, moving the window also gives odd screen behaviors.
a compleetly gray screen for example.
[Environment = 3.3.0.0 under WIN_XP/Service Pack 3 X86]

#cs
	GUICtrlSetBkColor delayed mishap.(Labels turn White)
	following code displays a window with a 10x10 label grid.
	while running, the label's background color is continus changed (random label + random color)
	after running for some time, all labels turn white.
	* move mouse around to speed things up. (~15x Faster)+(mishap after ~5sec/2.4Mhz)
	Also when the labels are white, moving the window also gives odd screen behaviors.
	- compleetly gray screen for example.
	[Environment = 3.3.0.0 under  WIN_XP/Service Pack 3 X86]
#ce

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <Array.au3>

;~ #include <Debug.au3>
;~ ConsoleWrite( _DebugBugReportEnv() & @CRLF)

Global Enum _
		$LED_COUNT_X, _
		$LED_COUNT_Y, _
		$LED_SIZE_X, _
		$LED_SIZE_Y, _
		$LED_MARGEN_X, _
		$LED_MARGEN_Y, _
		$WINDOW_MARGEN_XY, _
		$LEDGROUP_SIZE_X, _
		$LEDGROUP_SIZE_Y, _
		$WINDOW_SIZE_X, _
		$WINDOW_SIZE_Y, _
		$WINDOW_ID, _
		$Data_A_Size

Global $Data_A[$Data_A_Size]

$Data_A[$LED_COUNT_X] = 10
$Data_A[$LED_COUNT_Y] = 10
$Data_A[$LED_SIZE_X] = 20
$Data_A[$LED_SIZE_Y] = 20
$Data_A[$LED_MARGEN_X] = 4
$Data_A[$LED_MARGEN_Y] = 4
$Data_A[$WINDOW_MARGEN_XY] = 10

$Data_A[$LEDGROUP_SIZE_X] = _
		($Data_A[$LED_SIZE_X] * $Data_A[$LED_COUNT_X]) + _
		($Data_A[$LED_MARGEN_X] * ($Data_A[$LED_COUNT_X] + 1))
$Data_A[$LEDGROUP_SIZE_Y] = _
		($Data_A[$LED_SIZE_Y] * $Data_A[$LED_COUNT_Y]) + _
		($Data_A[$LED_MARGEN_Y] * ($Data_A[$LED_COUNT_Y] + 1))
$Data_A[$WINDOW_SIZE_X] = $Data_A[$LEDGROUP_SIZE_X] + ($Data_A[$WINDOW_MARGEN_XY] * 2)
$Data_A[$WINDOW_SIZE_Y] = $Data_A[$LEDGROUP_SIZE_Y] + ($Data_A[$WINDOW_MARGEN_XY] * 2)

Global Enum _
		$LED_ID, _
		$LED_COL, _
		$Led_A_Size

Global $Led_A[($Data_A[$LED_COUNT_X] * $Data_A[$LED_COUNT_Y]) + 1][$Led_A_Size]

SRandom(Mod(TimerInit(), 2 ^ 32) - (2 ^ 31)) ;; (SRandom,InputRange: -2^31..2^31-1)

MAIN()
Exit

Func MAIN()
	BuildGui()
	GuiWait()
;~ 	_ArrayDisplay($Led_A) ;; to show that colors are not set to same color/white.
EndFunc   ;==>MAIN

Func BuildGui()
	$Data_A[$WINDOW_ID] = GUICreate('Colorful Led Test', $Data_A[$WINDOW_SIZE_X], $Data_A[$WINDOW_SIZE_Y], -1, -1)
	GUICtrlCreateLabel('', _
			$Data_A[$WINDOW_MARGEN_XY], $Data_A[$WINDOW_MARGEN_XY], _
			$Data_A[$LEDGROUP_SIZE_X], $Data_A[$LEDGROUP_SIZE_Y], _
			$SS_ETCHEDFRAME)

	Local $Style = $SS_SUNKEN
	If ($Data_A[$LED_MARGEN_X] < 2) Or ($Data_A[$LED_MARGEN_Y] < 2) Then $Style = 0

	Local $LedNr = 0
	Local $PosX, $PosY
	For $iy = 1 To $Data_A[$LED_COUNT_Y]
		For $ix = 1 To $Data_A[$LED_COUNT_X]
			$LedNr += 1
			$PosX = (($ix - 1) * ($Data_A[$LED_SIZE_X] + $Data_A[$LED_MARGEN_X])) + $Data_A[$LED_MARGEN_X] + $Data_A[$WINDOW_MARGEN_XY]
			$PosY = (($iy - 1) * ($Data_A[$LED_SIZE_Y] + $Data_A[$LED_MARGEN_Y])) + $Data_A[$LED_MARGEN_Y] + $Data_A[$WINDOW_MARGEN_XY]
			$Led_A[$LedNr][$LED_ID] = GUICtrlCreateLabel('', $PosX, $PosY, _
					$Data_A[$LED_SIZE_X], $Data_A[$LED_SIZE_Y], _
					$Style)
		Next
	Next
	GUISetState(@SW_SHOW, $Data_A[$WINDOW_ID])
EndFunc   ;==>BuildGui

Func GuiWait()
	Local $msg
	While 1
		Do
			$msg = GUIGetMsg()
			If $msg = $GUI_EVENT_CLOSE Then ExitLoop 2
		Until Not $msg
		Led_Set()
	WEnd
EndFunc   ;==>GuiWait

Func Led_Set()
	Local $LEdColor = RndColor()
	Local $LedNr = Random(1, UBound($Led_A, 1) - 1, 1)
	$Led_A[$LedNr][$LED_COL] = $LEdColor
	GUICtrlSetBkColor($Led_A[$LedNr][$LED_ID], $LEdColor)

EndFunc   ;==>Led_Set

Func RndColor()
	Local $r, $g, $b
	$r = BitShift(Round(Random() * 255), -16)
	$g = BitShift(Round(Random() * 255), -8)
	$b = BitShift(Round(Random() * 255), 0)
	Return $r + $g + $b
EndFunc   ;==>RndColor

Attachments (0)

Change History (2)

comment:1 Changed 15 years ago by MvGulik

While Trying to take a printscreen-screenshot (for attachment),
I got a 'Insufficient memory to create the bitmap. ...' message.
(in case it matters, having 768mb of memory, with ~315mb free when running above progam)

comment:2 Changed 15 years ago by Jpm

  • Milestone set to 3.3.1.0
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in version: 3.3.1.0

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 owner will remain Jpm.
Author


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

 
Note: See TracTickets for help on using tickets.