DaLiMan Posted December 8, 2005 Share Posted December 8, 2005 Hi, Does anybody have a good idea on how to change the BkColor for 14 / 15 controls (Radio_101 to Radio_115) in an instand and not having to write every control seperately? I have a GUI were the user can select some items, when selected the item is highlighted using a BkColor. Now the problem is when the user selects another one, then the previous BkColor is not changed back. Is there a loop or something for this?? expandcollapse popup; ; ; Access Form Exporter v.01 ; dhombs@cox.net ; #include <GuiConstants.au3> Global $style = $WS_POPUP + $WS_BORDER Global $CQR_Oorzaak, $CQR_Foutcode, $msg, $msg2 #region --- GUI Definition --- GuiCreate("CQR-Foutcode2", 860, 310, (@DesktopWidth-860)/2, (@DesktopHeight-500)/2, $style) GUISetBkColor (0xFFFFFF) $CQR_Foutcode_Select = GUICtrlCreateButton("Selecteer", 220,220,80,25) GUICtrlSetState(-1, $GUI_DEFBUTTON) $CQR_Foutcode_Leeg = GUICtrlCreateButton("Laat leeg", 320,220,80,25) $CQR_Foutcode_Stop = GUICtrlCreateButton("S T O P", 520,220,80,25) GUICtrlCreateGroup ("Foutcode Reclamatie", 20, 34, 820, 99) GuiCtrlSetFont (-1, 10, 600, 0, "Tahoma") GUIStartGroup() $Radio_101=GuiCtrlCreateRadio("1/ verkeerd artikel", 38, 59, 135, 16) $Radio_102=GuiCtrlCreateRadio("2/ artikel niet geleverd", 38, 79, 135, 16) $Radio_103=GuiCtrlCreateRadio("3/ te veel geleverd", 38, 97, 135, 16) $Radio_104=GuiCtrlCreateRadio("4/ te weinig geleverd", 189, 59, 135, 16) $Radio_105=GuiCtrlCreateRadio("5/ breuk / transportschade", 189, 79, 145, 16) $Radio_106=GuiCtrlCreateRadio("6/ te vroeg geleverd", 189, 98, 135, 16) $Radio_107=GuiCtrlCreateRadio("7/ te laat geleverd", 340, 59, 135, 16) $Radio_108=GuiCtrlCreateRadio("8/ artikel defect", 340, 79, 135, 16) $Radio_109=GuiCtrlCreateRadio("9/ service, géén reclamatie", 340, 98, 145, 16) $Radio_110=GuiCtrlCreateRadio("10a/ prijs / korting", 491, 59, 135, 16) $Radio_111=GuiCtrlCreateRadio("11/ dubbel ingevoerd / besteld", 642, 78, 175, 16) $Radio_112=GuiCtrlCreateRadio("12/ andere fout van Solar", 642, 97, 165, 16) $Radio_113=GuiCtrlCreateRadio("10b/ ordergegevens", 491, 79, 135, 16) $Radio_114=GuiCtrlCreateRadio("10c/foutief afleveradres", 491, 97, 135, 16) $Radio_115=GuiCtrlCreateRadio("10d/ foutief klantnr.", 642, 58, 135, 16) GUICtrlCreateGroup ("Oorzaak", 20, 147, 820, 60) GuiCtrlSetFont (-1, 10, 600, 0, "Tahoma") GUIStartGroup() $Radio_3=GuiCtrlCreateRadio("C / Centraal magazijn", 408, 172, 121, 16) $Radio_5=GuiCtrlCreateRadio("E / Expediteur", 567, 172, 121, 16) $Radio_9=GuiCtrlCreateRadio("I / Inkoop", 170, 172, 115, 16) $Radio_11=GuiCtrlCreateRadio("K / Klant", 699, 172, 121, 16) $Radio_12=GuiCtrlCreateRadio("L / Leverancier", 38, 172, 121, 16) $Radio_22=GuiCtrlCreateRadio("V / Verkoop", 287, 172, 121, 16) $RadioChk1 = $Radio_108 $RadioChk2 = $Radio_3 GUICtrlSetState ($RadioChk1,$GUI_CHECKED) GUICtrlSetBkColor($RadioChk1, 0xFFFFCC) GUICtrlSetState ($RadioChk2,$GUI_CHECKED) GUICtrlSetBkColor($RadioChk2, 0xFFFFCC) #endregion --- GUI Definition --- GuiSetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $CQR_Foutcode_Stop Exit Case $msg = $CQR_Foutcode_Select ;~ MsgBox(0, "Button", "Radio " & Chr($radioval2 + Asc("C")) ) MsgBox(0, "Button", "Radio " & $CQR_Foutcode) Case $msg >= $Radio_101 And $msg <= $Radio_115 GUICtrlSetBkColor($msg, 0xFFFFCC) $CQR_Foutcode = $msg - $radio_101 + 1 If $CQR_Foutcode = 10 Then $CQR_Foutcode = "10a" If $CQR_Foutcode = 13 Then $CQR_Foutcode = "10b" If $CQR_Foutcode = 14 Then $CQR_Foutcode = "10c" If $CQR_Foutcode = 15 Then $CQR_Foutcode = "10d" Case $msg >= $radio_3 And $msg <= $Radio_22 If $msg = $radio_3 Then $CQR_Oorzaak = "C" If $msg <> $radio_3 Then GUICtrlSetBkColor($radio_3, 0xFFFFFF) If $msg = $radio_5 Then $CQR_Oorzaak = "E" If $msg <> $radio_5 Then GUICtrlSetBkColor($radio_5, 0xFFFFFF) If $msg = $radio_9 Then $CQR_Oorzaak = "I" If $msg <> $radio_9 Then GUICtrlSetBkColor($radio_9, 0xFFFFFF) If $msg = $radio_11 Then $CQR_Oorzaak = "K" If $msg <> $radio_11 Then GUICtrlSetBkColor($radio_11, 0xFFFFFF) If $msg = $radio_12 Then $CQR_Oorzaak = "L" If $msg <> $radio_12 Then GUICtrlSetBkColor($radio_12, 0xFFFFFF) If $msg = $radio_22 Then $CQR_Oorzaak = "V" If $msg <> $radio_22 Then GUICtrlSetBkColor($radio_22, 0xFFFFFF) GUICtrlSetBkColor($msg, 0xFFFFCC) Case Else ;;; EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
GaryFrost Posted December 8, 2005 Share Posted December 8, 2005 I would suggest making an array of the controls, then using a loop change them before the loop use the GUISetState(@SW_LOCK) after the loop GUISetState(@SW_UNLOCK) see if that will work for you. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DaLiMan Posted December 8, 2005 Author Share Posted December 8, 2005 Thanx Gafrost, That was a good suggestion, added these lines and works great now!!!! After the $Radio buttons: $avArray = _ArrayCreate($Radio_3, $Radio_5, $Radio_9, $Radio_11, $Radio_12, $Radio_22, _ $Radio_101, $Radio_102, $Radio_103, $Radio_104, $Radio_105, $Radio_106, $Radio_107, _ $Radio_108, $Radio_109, $Radio_110, $Radio_111, $Radio_112, $Radio_113, $Radio_114, $Radio_115 ) Within the While loop from the GUI: GUISetState(@SW_LOCK) For $i = 1 to UBound($avArray,1) GUICtrlSetBkColor($i, 0xFFFFF8) Next GUISetState(@SW_UNLOCK) Oh, and don't forget [ #include <Array.au3> ]........ 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