jugador Posted November 12, 2020 Share Posted November 12, 2020 Example taken from Autoit help file Working properly if put out of loop CreateChild() but not working if try to plot on button click expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $h_GUI Example() Func Example() Local $0A_MButton $h_GUI = GUICreate ("------", 500, 400, 50, 80) $0A_MButton = GUICtrlCreateButton("^", 210, 3, 30, 23) ;;CreateChild() ;;<<======= Working properly GUISetState(@SW_SHOW) Local $idMsg ;---- While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE ExitLoop Case $idMsg = $0A_MButton CreateChild();;<<======= not Working only showing broder EndSelect WEnd ;---- GUIDelete($h_GUI) EndFunc ;==>Example Func CreateChild() Local $g_aidGraphics[7] ;;============= $g_aidGraphics[1] = GUICtrlCreateGraphic(20, 50, 100, 100) GUICtrlSetBkColor($g_aidGraphics[1], 0xffffff) GUICtrlSetColor($g_aidGraphics[1], 0) GUICtrlSetGraphic($g_aidGraphics[1], $GUI_GR_COLOR, 0xff0000, 0xff0000) GUICtrlSetGraphic($g_aidGraphics[1], $GUI_GR_PIE, 50, 50, 40, 30, 270) GUICtrlSetGraphic($g_aidGraphics[1], $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic($g_aidGraphics[1], $GUI_GR_PIE, 58, 50, 40, -60, 90) GUICtrlSetGraphic($g_aidGraphics[1], $GUI_GR_ELLIPSE, 100, 100, 50, 80) GUICtrlSetGraphic($g_aidGraphics[1], $GUI_GR_COLOR, 0x00ff00, 0xc0c0ff) GUICtrlSetGraphic($g_aidGraphics[1], $GUI_GR_RECT, 350, 200, 50, 80) ;;============= $g_aidGraphics[2] = GUICtrlCreateGraphic(220, 10, 100, 100) GUICtrlSetGraphic($g_aidGraphics[2], $GUI_GR_COLOR, 0, 0xff) GUICtrlSetGraphic($g_aidGraphics[2], $GUI_GR_PIE, 50, 50, 40, 30, 270) GUICtrlSetGraphic($g_aidGraphics[2], $GUI_GR_COLOR, 0x00ff00, 0xffffff) GUICtrlSetGraphic($g_aidGraphics[2], $GUI_GR_PIE, 58, 50, 40, -60, 90) ;;============= $g_aidGraphics[3] = GUICtrlCreateGraphic(220, 110, 100, 100) GUICtrlSetBkColor($g_aidGraphics[3], 0xf08080) GUICtrlSetColor($g_aidGraphics[3], 0xff) GUICtrlSetGraphic($g_aidGraphics[3], $GUI_GR_HINT, 1) GUICtrlSetGraphic($g_aidGraphics[3], $GUI_GR_COLOR, 0xff00) GUICtrlSetGraphic($g_aidGraphics[3], $GUI_GR_RECT, 50, 50, 80, 80) ;;============= $g_aidGraphics[4] = GUICtrlCreateGraphic(20, 200, 80, 80) GUICtrlSetBkColor($g_aidGraphics[4], 0xffffff) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_HINT, 1) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_MOVE, 10, 10) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_COLOR, 0xff) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_LINE, 30, 40) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_COLOR, 0xff00) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_LINE, 70, 70) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_COLOR, 0xff0000) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_LINE, 10, 50) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_COLOR, 0xffff00) GUICtrlSetGraphic($g_aidGraphics[4], $GUI_GR_LINE, 10, 10) ;;============= $g_aidGraphics[5] = GUICtrlCreateGraphic(150, 10, 50, 50) GUICtrlSetBkColor($g_aidGraphics[5], 0xa0ffa0) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_MOVE, 20, 20) ; start point ; it is better to draw line and after point ; to avoid to switch color at each drawing GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_COLOR, 0x0000ff) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_DOT, 30, 30) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_COLOR, 0) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_LINE, 20, 40) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_COLOR, 0xff0000) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_DOT, 25, 25) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_COLOR, 0) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_LINE, 40, 40) GUICtrlSetGraphic($g_aidGraphics[5], $GUI_GR_DOT, 30, 40) ;;============= $g_aidGraphics[6] = GUICtrlCreateGraphic(110, 260, 230, 130) GUICtrlSetColor($g_aidGraphics[6], 0) ; to display a black border line GUICtrlSetBkColor($g_aidGraphics[6], 0xc0c0ff) GUICtrlSetGraphic($g_aidGraphics[6], $GUI_GR_HINT, 3) ; to display control lines and end points GUICtrlSetGraphic($g_aidGraphics[6], $GUI_GR_COLOR, 0, 0xff); fill in blue GUICtrlSetGraphic($g_aidGraphics[6], $GUI_GR_MOVE, 120, 20) ; start point GUICtrlSetGraphic($g_aidGraphics[6], $GUI_GR_BEZIER, 120, 100, 200, 20, 200, 100) GUICtrlSetGraphic($g_aidGraphics[6], $GUI_GR_BEZIER + $GUI_GR_CLOSE, 100, 40, 40, 100, 40, 20) GUICtrlSetGraphic($g_aidGraphics[6], $GUI_GR_LINE, 60, 30) ; start point ;;============= EndFunc ;==>CreateChild Link to comment Share on other sites More sharing options...
jugador Posted November 12, 2020 Author Share Posted November 12, 2020 so have to use _WinAPI_InvalidateRect($h_GUI) or GUICtrlSetGraphic(.....,$GUI_GR_REFRESH) Func Example() .......... .......... .......... .......... GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $0A_MButton CreateChild() _WinAPI_InvalidateRect($h_GUI) EndSwitch Wend EndFunc or Func CreateChild() Local $g_aidGraphics[7] .......... .......... .......... .......... GUICtrlSetGraphic($g_aidGraphics[6], $GUI_GR_LINE, 60, 30) ; start point GUICtrlSetGraphic($g_aidGraphics[6],$GUI_GR_REFRESH) ;;============= EndFunc ;==>CreateChild Link to comment Share on other sites More sharing options...
Nine Posted November 12, 2020 Share Posted November 12, 2020 add this line after child creation : _WinAPI_RedrawWindow($h_GUI) jugador 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
jugador Posted November 13, 2020 Author Share Posted November 13, 2020 (edited) Thanks @Nine, above mention all 3 method work. Edited November 13, 2020 by jugador Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now