oMBRa Posted October 10, 2008 Share Posted October 10, 2008 My graphic won't redraw when I click Go expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $pi = 3.14159265358979 Global $a[3] Global $ALPHA = 30 Global $HEIGHT = 150 $Draw = GUICreate("My Draw") $input = GUICtrlCreateInput("21", 300, 10, 50, 20) $updown = GUICtrlCreateUpdown($input) $Button = GUICtrlCreateButton("Go", 300, 50) Example() Func Example() Local $msg MakeDraw() Do $msg = GUIGetMsg() If $msg = $Button Then Global $ALPHA = GUICtrlRead($input) Draw() EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Func MakeDraw() Local $x, $z $a[1] = GUICtrlCreateGraphic(10, 200, 10, 10) GUICtrlSetStyle(-1, $SS_NOTIFY) $a[2] = GUICtrlCreateGraphic(0, 0, 10, 10) GUICtrlSetStyle(-1, $SS_NOTIFY) ;GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0x) Draw() GUISetState() EndFunc ;==>MakeDraw Func Draw() For $i = 1 To $HEIGHT GUICtrlSetGraphic($a[1], $GUI_GR_PIXEL, 0, -$i);altezza Next $degToRad = $pi / 180 $z = Tan(Execute('$ALPHA * $degToRad')) $z = Execute('$HEIGHT / $z') For $i = 1 To $z GUICtrlSetGraphic($a[1], $GUI_GR_PIXEL, $i, 0);base Next $ipotenusa = Sqrt(Execute('$HEIGHT^2 + $z^2')) GUICtrlSetGraphic($a[1], $GUI_GR_MOVE, 0, -$HEIGHT) GUICtrlSetGraphic($a[1], $GUI_GR_LINE, $z, 0);ipotenusa ;GUICtrlSetGraphic($a[2], $GUI_GR_COLOR, 0, 0x) GUICtrlSetGraphic($a[2], $GUI_GR_PIE, Execute('40 + $z - 30'), 200, 20, 180, -$ALPHA) EndFunc ;==>Draw Link to comment Share on other sites More sharing options...
andybiochem Posted October 10, 2008 Share Posted October 10, 2008 You need to tell the graphic control to refresh. Put this at the bottom of your Draw() function. GUICtrlSetGraphic($a[1],$GUI_GR_REFRESH) GUICtrlSetGraphic($a[2],$GUI_GR_REFRESH) - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
oMBRa Posted October 10, 2008 Author Share Posted October 10, 2008 ok, but now it overlaps the previous triangle Link to comment Share on other sites More sharing options...
andybiochem Posted October 10, 2008 Share Posted October 10, 2008 Two options here:1) delete the graphic controls and re-create them each time the button is clicked2) look here - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
oMBRa Posted October 10, 2008 Author Share Posted October 10, 2008 Two options here:1) delete the graphic controls and re-create them each time the button is clicked2) look hereI managed to do it with deleting and re-creating 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