BlackFlag Posted July 13, 2023 Share Posted July 13, 2023 I am curtain that is nothing more than a Homer Moment for me but I'll be damned if see anything obvious here. What the full program is meant to do (and does). I get a P.O from a dealer. I send the P.O. to our AR person ( the company that owns my firm has the books set up kinda weird for reasons that made some sense in 2017) The AR folks email me the invoice which I email to the dealer who sends the check to the AR folks. The program was written many years ago as a quick and dirty product and the full thing works well for me. However, it needs to be less dirty now since I am going to out of the office for a month. So, I want to disable buttons that are not used in the active tab and reactive them when needed. Here is the code. I am obviously doing something wrong but I don't know what. expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #include <File.au3> #Include <Array.au3> #include <Date.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <OutlookEX.au3> $Dealsendmail="" $Form1 = GUICreate("Money Move", 250, 314, 100, 218) $PageControl1 = GUICtrlCreateTab(8, 8, 200, 230) $TabPO = GUICtrlCreateTabItem("POs") $POLists = GUICtrlCreateCombo("POLists", 16, 40, 150, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $TabInvoice = GUICtrlCreateTabItem("Invoices") $Dealerlist = GUICtrlCreateCombo("Dealer list", 16, 40, 175, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $InvoiceLists = GUICtrlCreateCombo("", 16, 70, 100, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlCreateTabItem("") $emailEd = GUICtrlCreateButton("Email Ed", 6, 250, 75, 25) $NoteemailEd = GUICtrlCreateCheckbox("Add note to Ed", 150, 250, 218, 25) $emailDealer = GUICtrlCreateButton("Email Dealer", 6, 275, 75, 25) $adddealeremail= GUICtrlCreateButton("Add Email", 118, 275, 75, 25) GUICtrlSetState($emailDealer,$GUI_DISABLE) GUICtrlSetState($adddealeremail,$GUI_DISABLE) GUISetState(@SW_SHOW) ;some code to populate various things. All works While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $emailEd ;send email to AR ; various magic to send the email and log the event Exit Case $emailDealer ; Send invoice to dealer GUICtrlSetState($emailDealer,64);$GUI_ENABLE) GUICtrlSetState($adddealeremail,$GUI_ENABLE) GUICtrlSetState($emailEd,$GUI_DISABLE) ; various magic to send the email and log the event EndSwitch WEnd Link to comment Share on other sites More sharing options...
Solution Subz Posted July 13, 2023 Solution Share Posted July 13, 2023 You can't use the $emailDealer button after you've already disabled it, you would need some type of event to occur for example when switching tabs While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $emailEd ;send email to AR Exit Case $PageControl1 If GUICtrlRead($PageControl1) = 0 Then ;~ If tab 0 then do this GUICtrlSetState($emailDealer, $GUI_DISABLE) GUICtrlSetState($adddealeremail,$GUI_DISABLE) GUICtrlSetState($emailEd,$GUI_ENABLE) ElseIf GUICtrlRead($PageControl1) = 1 Then ;~ If tab 1 then do this GUICtrlSetState($emailDealer, $GUI_ENABLE) GUICtrlSetState($adddealeremail,$GUI_ENABLE) GUICtrlSetState($emailEd,$GUI_DISABLE) EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
BlackFlag Posted July 13, 2023 Author Share Posted July 13, 2023 Thanks, that did the trick. A couple of other things are not working now but those are all marked ;Kludge come back and fix this Guess now's the time... 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