jorgev Posted August 15, 2013 Share Posted August 15, 2013 (edited) Hi all, I'm not an experienced coder so i'm having some difficulties converting a Switch to a Select. Here is a piece of code to illustrate what i'm trying to do. This function will normally show a tooltip when i hover over a button in a toolbar. As commented the Switch is working as intended, but if i use the Select it is not working, it will actually show the "New" tooltip for every button instead of the relative tooltip. Anyone could give an explanation of what i'm doing wrong? tx alot EDIT: i want to convert to "Select" because later on i will ad other cases to be checked for instead of only "Case $iCode = $TTN_GETDISPINFOW" in this example. expandcollapse popup; Handle WM_NOTIFY messages Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam, $ilParam Local $tInfo, $iID, $iCode $tInfo = DllStructCreate($tagNMTTDISPINFO, $ilParam) $iCode = DllStructGetData($tInfo, "Code") ;~ ********** Select variation (does not work) ***************** Select Case $iCode = $TTN_GETDISPINFOW $iID = DllStructGetData($tInfo, "IDFrom") Select Case $iID Select Case $idNew DllStructSetData($tInfo, "aText", "New") Case $idOpen DllStructSetData($tInfo, "aText", "Open") Case $idSave DllStructSetData($tInfo, "aText", "Save") Case $idHelp DllStructSetData($tInfo, "aText", "Help") EndSelect EndSelect EndSelect ;~ switch variation (works as intended) ************************** ;~ If $iCode = $TTN_GETDISPINFOW Then ;~ $iID = DllStructGetData($tInfo, "IDFrom") ;~ Switch $iID ;~ Case $idNew ;~ DllStructSetData($tInfo, "aText", "New");~ ;~ Case $idOpen ;~ DllStructSetData($tInfo, "aText", "Open") ;~ Case $idSave ;~ DllStructSetData($tInfo, "aText", "Save") ;~ Case $idHelp ;~ DllStructSetData($tInfo, "aText", "Help") ;~ EndSwitch ;~ EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Edited August 15, 2013 by jorgev Link to comment Share on other sites More sharing options...
FireFox Posted August 15, 2013 Share Posted August 15, 2013 (edited) Why do you want to use a Select? The Switch is really recommanded especially when you are comparing always the same var.Select Case $iID = $idNew DllStructSetData($tInfo, "aText", "New") Case $iID = $idOpen DllStructSetData($tInfo, "aText", "Open") Case $iID = $idSave DllStructSetData($tInfo, "aText", "Save") Case $iID = $idHelp DllStructSetData($tInfo, "aText", "Help") EndSelectBr, FireFox. Edited August 15, 2013 by FireFox Link to comment Share on other sites More sharing options...
jorgev Posted August 15, 2013 Author Share Posted August 15, 2013 Tx alot FireFox, Later on i will compare more then 1 var, that's why i wanted to learn how to do it with a Select. 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