Opened 16 years ago
Closed 16 years ago
#538 closed Bug (No Bug)
GUICtrlCreateGraphic - working on last GUI created
Reported by: | enaiman | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.2.12.0 | Severity: | None |
Keywords: | Cc: |
Description
Hi,
I'm not sure if this is an intended behaviour or a bug.
GUICtrlCreateGraphic since it doesn't use a window handle it creates the grapthic on the last GUI created; if that GUI was deleted GUICtrlCreateGraphic will fail.
Here is a sample script; it might not be the best example but it shows the above behaviour. Once the last GUI was deleted GUICtrlCreateGraphic will always return 0.
Maybe a future release might consider using a window handle in GUICtrlCreateGraphic call?
Thank you
{{{#include <GUIConstantsEx.au3>
GUICreate("1", 200, 200, 100)
$but2 = GUICtrlCreateButton("Create Gr Success", 20, 170, 160, 25)
GUISetState()
GUICreate ("2", 200, 200, 310)
GUISetState()
$but = GUICtrlCreateButton("Create Gr Fail", 20, 170, 160, 25)
$gg = GUICreate ("3", 200, 200, 520)
GUISetState()
Do
$msg = GUIGetMsg()
If $msg = $but Then
GUIDelete($gg)
$a = GUICtrlCreateGraphic(20, 50, 100, 100)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetColor(-1, 0)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000, 0xff0000)
GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 40, 30, 270)
GUICtrlSetState(-1, $GUI_SHOW)
MsgBox(0, "return", "Return code GUICtrlCreateGraphic "&$a, 2)
EndIf
If $msg = $but2 Then
$b = GUICtrlCreateGraphic(20, 50, 100, 100)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetColor(-1, 0)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000, 0xff0000)
GUICtrlSetGraphic(-1, $GUI_GR_PIE, 50, 50, 40, 30, 270)
GUICtrlSetState(-1, $GUI_SHOW)
MsgBox(0, "return", "Return code GUICtrlCreateGraphic "&$b, 2)
EndIf
Until $msg = $GUI_EVENT_CLOSE
}}}
Attachments (0)
Change History (1)
comment:1 Changed 16 years ago by Valik
- Resolution set to No Bug
- Status changed from new to closed
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.
This is not a bug. ANY control you try to create will fail. Controls are created on the GUI that is set internally as the "current" GUI. Since you deleted the current GUI, creation fails. To control what GUI controls are created on, use GUISwitch().