WundaGirl Posted June 17, 2010 Posted June 17, 2010 Anyone seen an issue where when they execute their script, a button does not display unless I move my mouse over its location?
DW1 Posted June 17, 2010 Posted June 17, 2010 (edited) Sure, this can happen when you lay the GUI out with overlapping controls... For example (this creates 100 buttons, but none can be seen due to the label sitting over the top of them... until you mouse over): #include <GUIConstantsEx.au3> $GUI = GUICreate("App", 500, 500, @DesktopWidth / 2) $i = 0 Dim $Button[1] For $a = 0 To 450 Step 50 For $b = 0 To 450 Step 50 $i += 1 ReDim $Button[$i] $Button[$i - 1] = GUICtrlCreateButton('B ' & $i, $a, $b, 50, 50) Next Next $Label = GUICtrlCreateLabel('', 0, 0, 500, 500) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Sleep(10) WEnd Edited June 17, 2010 by danwilli AutoIt3 Online Help
WundaGirl Posted June 17, 2010 Author Posted June 17, 2010 Just realized the size entries for the label text was overlapping my button. Although the text itself was no where near my button, the size allocations for the label text caused problems.
gwinter Posted May 13, 2020 Posted May 13, 2020 (edited) It's 2020, and although this is an old post, this was the only post that matched my exact problem. Although the information here is helpful to determine the problem, no solution is given. I researched and found out already that the problem is related to the rendering of GUI layers in Autoit, and I have been trying different solutions so fat without success. I am using Autoit with GDI+, and my intention is to have a GUI with background. I have been trying different GUI methods in Autoit, but there isn't a lot of information online about Autoit GUI layers or having textured buttons WITH a textured background. With ome of the GUI methods I tried, the buttons wouldn't even show up. Now, using GDI+, I have textured buttons and background, and even button hover and highlighting, but the buttons don't initially appear until you move the cursor over them. Here's what I have so far: When the window first opens... and then when the cursor passes over.. . Some online sources say it's a problem with the drawing order in AutoIt, some say that you have to show and hide the GUI controls in a certain order (including the background), and some say to use $WS_EX_LAYERED or $GUI_FOCUS to fix the problem, but so far nothing works. I do have working Autoit projects that have textured GUI's, so I just have to look in the code to see how they did it. So far, the best working example I found was from: https://www.autoitscript.com/forum/topic/166535-skin-udf/ EDIT: I was going to put an image of the buttons on the background so that they are shown, but that would require me to set up every background first. However, I figured out the problem while writing this post. SOLLUTION: Putting GUICtrlSetState(-1, $GUI_DISABLE) right after creating the background made the buttons show up properly. You would think that diasabling the background would hide it but in this case it doesn't. Create the background image control, then disable it. Here's my GUI menu code using GDI+, it doesn't have the code for button highlighting yet or the resource images, but it may help someone: expandcollapse popup;GUI_Menu1.au3 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <GDIPlus.au3> #include "NoFocusLines.au3" $fGlobal = True ; this will switch off all spots and lines for all controls ;pre-declared ;Global Const $IMAGE_BITMAP = 0 ;Global Const $STM_SETIMAGE = 0x0172 ;replacements Global $img_bmp = 0 Global $stm_setimg = 0x0172 Global $msg MainMenu() Func MainMenu() Global Const $mainWin = GUICreate("FFCC - Accumulator", 960, 565, -1, -1, $WS_EX_LAYERED) ; $WS_SIZEBOX + $WS_SYSMENU GUISetBkColor(0xE0FFFF) Global Const $idPic = GUICtrlCreatePic("Bkg1.jpg", 0, 0, 960, 544) GUICtrlSetState($idPic, $GUI_DISABLE) Global Const $Button1 = GUICtrlCreateButton("GILButton", 209, 93, 95, 63, $BS_ICON) GUICtrlSetImage($Button1, "button_GIL3.ico") Global Const $Button2 = GUICtrlCreateButton("SPButtonDis", 214, 193, 90, 63, $BS_ICON) GUICtrlSetImage($Button2, "button_SPdisabled.ico") GUISetState(@SW_SHOW, $mainWin) ; Loop until the user exits. While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button1 MsgBox(0,"DEBUG","GIL") Case $Button2 MsgBox(0,"DEBUG","SP") EndSwitch WEnd GUIDelete() EndFunc ;==>Example *Note: I will be releasing an assistant application for AutoIt soon that will help it function more like a modern-day game engine. It will include a GUI templating system that will set up GUI menus more efficiently.It will also include project templates, 3D rendering (currently using OpenGL and also Irrlicht), resource management, video support for MP4's, etc. Basically, it will be like the Unity Hub is for the Unity engine, and it will also help AutoIt to function as a game engine for PC and a project-manager for AutoIt, that incorporates commonly used resources, scripts, API's, etc. It also tracks AutoIt projects and keeps track of what resources and scripts are included in the "project". I have seen AutoIt do some amazing things, like run OpenGL at full speed, use the Irrlicht engine, function as an videogame-emulator, loading 3D models, particles and lots more. I am also working on a similar project for Godot, but I will try to finish the AutoIt Assistant project first and release it here and on my temporary site: http://honorsoft.tripod.com/honorsoft-hom Edited May 13, 2020 by gwinter
Zedna Posted May 14, 2020 Posted May 14, 2020 Look here, it's related also to your problem: Result: Do your painting in WM_PAINT or use ResourcesEx UDF. Resources UDF ResourcesEx UDF AutoIt Forum Search
gwinter Posted May 16, 2020 Posted May 16, 2020 To Zedna, the link you posted about GUI image flickering is not related to this problem. As I said in my post it was a problem due to GUI Layers in AutoIt. The problem is fixed by putting GUICtrlSetState(-1, $GUI_DISABLE) right after creating the background made the buttons show up properly.
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