Leaderboard
Popular Content
Showing content with the highest reputation on 05/29/2022 in all areas
-
Help with GUI - Enable button when input is populated (Dynamic Update)
PlayZoneUK and 2 others reacted to pixelsearch for a topic
Hi Subz Your solution works fine. Though in these cases, I prefer to register WM_COMMAND and test $EN_UPDATE (or $EN_CHANGE) etc... It allows to enable/disable the button at the exact moment when the input field is filled/emptied, without that little "visual delay" due to AdlibRegister (max 250ms by default, though it maybe diminished but it will then check AdlibRegister more frequently) Also, WM_COMMAND is only triggered when the user interferes with the controls (which is less frequent than repeated checks to AdlibRegister) This is a version with a registered WM_COMMAND : #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('GUIOnEventMode' , 1) Global $hGUI, $inp_Username, $btn_Search, $btn_Quit Global $App = "Test Application" _BuildGUI() While 1 Sleep(250) WEnd _Quit() Func _BuildGUI() $hGUI = GUICreate($App, 480, 80, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS), $WS_EX_WINDOWEDGE) ; Create GUI GUICtrlCreateLabel("&Username:", 20, 18, 75, 20) ; Create Username label $inp_Username = GUICtrlCreateInput("", 100, 15, 290, 20) ; Create Username input $btn_Search = GUICtrlCreateButton("&Search", 400, 15, 60, 20) ; Create Search Button GUICtrlSetOnEvent(-1, "_Search") ; Call _Search function when pressed GUICtrlSetState(-1, $GUI_DISABLE) $btn_Quit = GUICtrlCreateButton("&Quit", 400, 45, 60, 20) ; Create Quit Button GUICtrlSetOnEvent(-1, "_Quit") ; Call _Quit function when pressed GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') EndFunc Func _Search() MsgBox(4096, $App, "Search for user...") ; DO SOMETHING EndFunc Func _Quit() GUIDelete($hGUI) ; Delete the previous GUI and all controls. Exit EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) Switch $lParam Case GUICtrlGetHandle($inp_Username) Switch $nNotifyCode Case $EN_UPDATE ; "just before text is displayed." ; $EN_CHANGE would work too ("after the system updates the screen.") ; Local Static $iEn_Update = 0 ; $iEn_Update +=1 ; ConsoleWrite($iEn_Update & " $iEn_Update >" & GUICtrlRead($inp_Username) & "<" & @crlf) GUICtrlSetState($btn_Search, (GUICtrlRead($inp_Username) = "" ? $GUI_DISABLE : $GUI_ENABLE)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Have a great sunday.3 points -
Melba23 StringSize UDF could also be used as well, find it useful for calculating font size #include <GUIConstantsEx.au3> ;~ StringSize ;~ Author : Melba23 ;~ Download : https://www.autoitscript.com/forum/topic/114034-stringsize-m23-new-version-16-aug-11/ #include <StringSize.au3> Global $g_aCheckbox[4][2] = [["","/X"],["","/COPYALL"],["","/FP"],["","/BYTES"]] Global $g_iFontSize = 12 Global $g_iFontWeight = 400 Example() Func Example() Local $hGUI = GUICreate("Example", 400, 200) GUISetFont($g_iFontSize, $g_iFontWeight) Local $iX = 10, $aStringSize For $i = 0 To UBound($g_aCheckbox) - 1 $aStringSize = _StringSize($g_aCheckbox[$i][1], $g_iFontSize, $g_iFontWeight) $g_aCheckbox[$i][0] = GUICtrlCreateCheckbox($aStringSize[0], $iX, 10, $aStringSize[2] + 35, 25) GUICtrlSetBkColor(-1, 0x10FF00) $iX += $aStringSize[2] + 40 Next Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop EndSwitch WEnd EndFunc2 points
-
Spacing between checkboxes.
Musashi and one other reacted to pixelsearch for a topic
Hi ReconX If you look at the example found in help file, topic GUICtrlCreateCheckbox, you'll notice this line : Local $idCheckbox = GUICtrlCreateCheckbox("Standard Checkbox", 10, 10, 185, 25) But 185 is a too large width, compared to the checkbox size + its text. So what could we do to automatically set a width corresponding exactly to the checkbox size + its "Standard Checkbox" text ? The answer is : when creating the control, indicate a width = -1 and a size = -1, as shown in the following pic : Now the text fits perfectly and you can get the unknow width & height like this : Local $aPos = ControlGetPos($hGUI, "", $idCheckbox) MsgBox(0, "Checkbox", "Position: " & $aPos[0] & ", " & $aPos[1] & @CRLF & "Size: " & $aPos[2] & ", " & $aPos[3]) After that, it's a piece of cake to place the other checkboxes exactly where you like. Though "-1, -1" isn't clearly indicated in the help file, I guess they're the values that correspond to the 2 explanative lines found in the help file : "default text autofit in width" and "default text autofit in height" Good luck2 points -
Help with GUI - Enable button when input is populated (Dynamic Update)
PlayZoneUK and one other reacted to Subz for a topic
Hi PixelSearch To be honest having a lazy Sunday , WM_COMMAND is the better solution.2 points -
Sponsor ECI - GitHub will match your contribution
seadoggie01 reacted to TheDcoder for a topic
Sponsor development of EasyCodeIt - GitHub will match your contributions What? A few years ago I started working on a project called EasyCodeIt, it aims to be a scripting language with a syntax similar to AutoIt but also work cross-platform (Linux, Windows, Mac etc.) along with few more cool planned features like multi-threading, compile to byte-code etc. Who? I'm a passionate AutoIt user and a frequent visitor to the forum, I've been visiting the forum almost daily for more than 7 years! I started my programming journey with AutoIt and today I work as a software developer with expertise in all things automation. I am also a user of Linux and I've been using it as my primary OS for around 3 years. Aside from AutoIt I indulge in other programming language, both low and high-level alike. My other two favorite languages are C (great for low-level stuff and command line utilities) and JavaScript (great all purpose scripting language which runs anywhere). Why? The progress on this project happens on a snail's pace because of my work and personal life. Before 2020 I was working with multiple clients on long-term projects which left me with little-to-no time on hobby projects. But then COVID happened and many businesses went into loss, which included my clients and myself by extension. Since then I've been working on and off with new clients but I've never had a stable source of income. In the past 2 years I've lost around half of my life savings, and due to this I've also been suffering from mild depression which makes me inactive, both mentally and physically. So? Yesterday I was contacted by GitHub where they informed me that they had launched the "GitHub Sponsor" program in India and that I was one of the first to be selected! So now I've decided to seriously start pursuing my dream of working on open-source projects and put bread on my table at the same time. What do I get? Excellent question! You will get the following: A cross-platform programming language which follows AutoIt's simple principles Regular progress reports (at-least once per week) All code which will be published as open-source A badge on your GitHub profile Your name or nickname in the "Early Supporters" list in the documentation forever (optional, must donate $5 or more) My eternal gratitude! ...More? Normally I charge $20/hour to my clients, but since this project benefits all of us and it will also serve as a valuable learning experience for me, I'll work 1 hour for $10! I promise to use the sponsor funds to take time out of my work schedule and work on EasyCodeIt itself. For transparency I'll be publishing regular (perhaps weekly) work reports with the following: Number of hours I worked on EasyCodeIt What I worked on Sharing of code upon request But wait! GitHub has a Matching Fund, and with that for a limited time and they'll match your donations 1:1! That means if you donate $10, GitHub will match your donation and they will donate a matching sum of an additional $10 from their pocket! That means I get $20 in the end! Essentially you'll get 4x times the amount of work compared to my commercial work! So if you can spare the change, please do consider funding this project. Let's do this! Sponsor me at GitHub. I recommend you to donate at-least $5 dollars as that will guarantee at-least an hour of work from me. And if you can afford it, donate as much as you want and take advantage of GitHub's matching fund. If enough people donate we can make significant progress, maybe even a usable programming language! Also please feel free to share your thoughts and discuss aspects of this, and any ideas you might have, I really appreciate your response.1 point -
@TheSaint Thanks bud. I promise to buy you a lifetime supply of Krispy Creme donuts after I become a millionaire Not so fast, there are two things that would get in the way: GitHub only matches up to $5000 for each eligible "sponsored person" They review each transaction to check if it is eligible for the matching fund, so stuff like this wouldn't happen I wish. This is not a job offer nor am I employed by anyone, this is just a community thing and GitHub is only providing a platform for developers to accept $ The GitHub Matching Fund is an initiative to encourage community funding, it's not something that will go on forever. Each sponsored person is actually only eligible for the first 12 months to get matching funds. And if I recall correctly they aren't accepting any new applicants to this fund.1 point
-
Wrong, it is prod in 3.3.16.0 and it is stable. But if array is what you understand more, i guess you should go ahead with it, but you are missing a good opportunity to learn a new approach.1 point
-
As stated: I won't be making this (rather easy) change myself in the SciTE4AutoIt3 version unless it is made in the official version published by Neil Hodgson, which I use to apply my changes specifically for AutoIt3. I doubt many people will be running scripts from SciTE that take longer than a day as to me SciTE is used to develop scripts and not to run them for a long period.1 point