Khryus Posted March 3, 2013 Share Posted March 3, 2013 So I was writing a program to sort my collection of animes yesterday and I stumbled upon this glitch. Basically, I have a TabControl with 3 tabs: each tab has a ListBox of the same size at the same position (just in case, style: BitOR($LBS_NOTIFY,$LBS_SORT,$WS_VSCROLL), font is Arial) On the first tab I have a ListBox filled with about 22 lines. Each line represents an anime folder on my ext. hdd. Each anime folder has a 'season' folder inside it, and inside each season folder the respective episodes. So it's like: Anime Folder \ Season 1 Folder \ [episodes] When the anime list is filled and I update the seasons list with the season folders (by clicking on an item in the anime list), this happens: as the seasons list is updated and items are being added in the list, it covers the anime list. I can 'fix' this by scrolling up and down in the anime list, so the other list disappears. Why is that happening? Is it due to my code or is it a bug in autoit? "The story of a blade is linked in Blood." ―Yasuo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 3, 2013 Moderators Share Posted March 3, 2013 megablox, My money would be firmly on your code. So why not post it so we can help you find out if it is? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Khryus Posted March 3, 2013 Author Share Posted March 3, 2013 (edited) Here's the codeexpandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> #include <GuiListBox.au3> #include <GuiTab.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include "udf\RecFileListToArray.au3" #include <WinAPI.au3> #include <WindowsConstants.au3> ;~ HotKeySet("1", "show1") ;~ HotKeySet("2", "show2") ;~ HotKeySet("3", "show3") ;~ HotKeySet("q", "hide1") ;~ HotKeySet("w", "hide2") ;~ HotKeySet("e", "hide3") Opt("GUIOnEventMode", 1) Global $currentRating=0, $configured=False, $firstRun=True, $defaultVideoDir, $updateOnLaunch, $askUpdateOnLaunch, $resumeFromLastVideo, $breakPlaylist, $defaultPlayer Global $currentSelection=0, $canBeRated=False, $numberOfAnimes, $currentTab $Form1 = GUICreate("Anime DB 2.0", 689, 358, 178, 124) $mSettings = GUICtrlCreateMenu("&Settings") $smOpenSettings = GUICtrlCreateMenuItem("Open settings dialog", $mSettings) GUICtrlSetOnEvent(-1, "openSettingsWindow") $oTab1 = GUICtrlCreateTab(0, 0, 417, 329) $tList = GUICtrlCreateTabItem("List of animes") $animeList = GUICtrlCreateList("", 8, 32, 401, 280, BitOR($LBS_NOTIFY,$LBS_SORT,$WS_VSCROLL), 0) GUICtrlSetOnEvent(-1, "updateSeasonsList") GUICtrlSetFont(-1, 8, 400, 0, "Arial") $seasonList = GUICtrlCreateList("", 8, 32, 401, 280, BitOR($LBS_NOTIFY,$LBS_SORT,$WS_VSCROLL), 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $episodesList = GUICtrlCreateList("", 8, 32, 401, 280, BitOR($LBS_NOTIFY,$LBS_SORT,$WS_VSCROLL), 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $tSeasons = GUICtrlCreateTabItem("Seasons") $tEpisodes = GUICtrlCreateTabItem("Episodes") GUICtrlCreateTabItem("") $Group1 = GUICtrlCreateGroup("General Informations", 424, 16, 257, 313) $cover = GUICtrlCreatePic("res\not_available.bmp", 552, 32, 124, 172) $star1 = GUICtrlCreatePic("res\passive_square.bmp", 432, 40, 13, 13) GUICtrlSetOnEvent(-1, "star1") $star2 = GUICtrlCreatePic("res\passive_square.bmp", 445, 40, 13, 13) GUICtrlSetOnEvent(-1, "star2") $star3 = GUICtrlCreatePic("res\passive_square.bmp", 458, 40, 13, 13) GUICtrlSetOnEvent(-1, "star3") $star4 = GUICtrlCreatePic("res\passive_square.bmp", 471, 40, 13, 13) GUICtrlSetOnEvent(-1, "star4") $star5 = GUICtrlCreatePic("res\passive_square.bmp", 484, 40, 13, 13) GUICtrlSetOnEvent(-1, "star5") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState(@SW_SHOW) $Form2 = GUICreate("Settings", 385, 253, 470, 205, -1, -1, $Form1) $ConfigWinLabel = GUICtrlCreateLabel("This is the settings window - in here you can change how the program works.", 8, 8, 367, 17) $Label2 = GUICtrlCreateLabel("Default video directory", 8, 40, 110, 17, $WS_BORDER) $iVideoDir = GUICtrlCreateInput("None selected.", 8, 64, 257, 21) GUICtrlSetOnEvent(-1, "checkOK") GUICtrlSetState(-1, $GUI_DISABLE) $browseVideoDir = GUICtrlCreateButton("Browse...", 272, 62, 75, 25) GUICtrlSetOnEvent(-1, "browseVideoDir") $videoDirPic = GUICtrlCreatePic("G:\Projects\AnimeDB 2.0\res\no.bmp", 352, 60, 30, 30) $Label3 = GUICtrlCreateLabel("Update lists on launch", 8, 99, 110, 17, $WS_BORDER) $Checkbox1 = GUICtrlCreateCheckbox("", 128, 99, 17, 17) GUICtrlSetOnEvent(-1, "switchStatus1") $Label4 = GUICtrlCreateLabel("Ask to update lists on launch", 8, 122, 142, 17, $WS_BORDER) $Checkbox2 = GUICtrlCreateCheckbox("", 158, 122, 17, 17) GUICtrlSetOnEvent(-1, "switchStatus2") $Label1 = GUICtrlCreateLabel("Automatically resume from where I left last time", 8, 145, 222, 17, $WS_BORDER) $Checkbox3 = GUICtrlCreateCheckbox("", 236, 145, 17, 17) $Label5 = GUICtrlCreateLabel("Break playlist key", 8, 168, 86, 17, $WS_BORDER) $Input1 = GUICtrlCreateInput("0", 104, 168, 41, 21) $Label6 = GUICtrlCreateLabel("Default media player", 8, 193, 166, 17, $WS_BORDER) $Group1 = GUICtrlCreateGroup("", 176, 186, 105, 25) $Radio1 = GUICtrlCreateRadio("WMP", 176, 192, 49, 17) $Radio2 = GUICtrlCreateRadio("VLC", 232, 192, 49, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("OK", 152, 165, 35, 25) GUICtrlSetOnEvent(-1, "checkOK") $Pic1 = GUICtrlCreatePic("G:\Projects\AnimeDB 2.0\res\no.bmp", 193, 167, 22, 22) $Pic2 = GUICtrlCreatePic("G:\Projects\AnimeDB 2.0\res\no.bmp", 289, 190, 22, 22) $Button2 = GUICtrlCreateButton("Save and close", 0, 224, 163, 25) GUICtrlSetOnEvent(-1, "saveAndClose") $Button3 = GUICtrlCreateButton("Close and discard", 221, 224, 163, 25) GUICtrlSetOnEvent(-1, "discardAndClose") GUISetOnEvent($GUI_EVENT_CLOSE, "closeSettings") ;notes ; ;find out a way to hide the other lists when you are on another one. ;hide other lists when in a specific tab? ;test area ;~ GUICtrlSetState($seasonList, $GUI_HIDE) ;~ GUICtrlSetState($episodesList, $GUI_HIDE) Func show1() GUICtrlSetState($animeList, $GUI_SHOW) EndFunc Func show2() GUICtrlSetState($seasonList, $GUI_SHOW) EndFunc Func show3() GUICtrlSetState($episodesList, $GUI_SHOW) EndFunc Func hide1() GUICtrlSetState($animeList, $GUI_HIDE) EndFunc Func hide2() GUICtrlSetState($seasonList, $GUI_HIDE) EndFunc Func hide3() GUICtrlSetState($episodesList, $GUI_HIDE) EndFunc ;end test area Switch FileExists("data\cfg.ini") Case 0 GUISetState(@SW_SHOW, $Form2) WinActivate($Form2, "") Do If WinActive($Form2) == 0 Then WinActivate($Form2) WinFlash($Form2, "", 10, 50) EndIf Until $configured=True $firstRun=False ConsoleWrite("Closing window."&@CRLF) Case Else $firstRun=False ConsoleWrite("Loading configuration."&@CRLF) $defaultVideoDir = IniRead("data\cfg.ini", "main", "sv.VideoDirectory", "default") $updateOnLaunch = IniRead("data\cfg.ini", "lists", "bv.UpdateOnLaunch", 1) $askUpdateOnLaunch = IniRead("data\cfg.ini", "lists", "bv.AskUpdateOnLaunch", 0) $resumeFromLastVideo = IniRead("data\cfg.ini", "media", "bv.AutomaticResume", 0) $breakPlaylist = IniRead("data\cfg.ini", "keys", "hk.InterruptPlaylist", "Q") $defaultPlayer = IniRead("data\cfg.ini", "media", "bv.MediaAgent", "VLC") GUICtrlSetData($iVideoDir, $defaultVideoDir) If $askUpdateOnLaunch == 1 And $updateOnLaunch == 1 Then Local $x=checkOK(1) Switch $x Case Not 0 Local $brokenrequest= MsgBox(20, "Corrupt configuration file", "There was an error while loading the configuration file: it appears to be corrupted. Do you want to delete it or manually reconfigure it?"&@CRLF&"Yes: delete and restore"&@CRLF&"No: manual restore") Switch $brokenrequest Case 6 MsgBox(64, "Restoring configuration", "Anime DB 2.0 will now be restored to defaults. The program will automatically restart.") ConsoleWrite("Deleting configuration file"&@CRLF) FileDelete("data\cfg.ini") Run("restoreadb.exe") ;don't forget to edit the source of restoreadb Case 7 ConsoleWrite("User opted for manual reconfiguration."&@CRLF) MsgBox(48, "Warning", "Anime DB 2.0 aborted the loading process because the save file was corrupt. The program will now close.") Exit EndSwitch EndSwitch EndIf Switch $updateOnLaunch Case 1 GUICtrlSetState($Checkbox1, $GUI_CHECKED) switchStatus1() EndSwitch Switch $askUpdateOnLaunch Case 1 GUICtrlSetState($Checkbox2, $GUI_CHECKED) switchStatus2() EndSwitch Switch $resumeFromLastVideo Case 1 GUICtrlSetState($Checkbox3, $GUI_CHECKED) EndSwitch GUICtrlSetData($Input1, $breakPlaylist) Switch $defaultPlayer Case "VLC" GUICtrlSetState($Radio2, $GUI_CHECKED) Case "WMP" GUICtrlSetState($Radio1, $GUI_CHECKED) EndSwitch Local $x=checkOK() Switch $x Case Not 0 Local $brokenrequest= MsgBox(20, "Corrupt configuration file", "There was an error while loading the configuration file: it appears to be corrupted. Do you want to delete it or manually reconfigure it?"&@CRLF&"Yes: delete and restore"&@CRLF&"No: manual restore") Switch $brokenrequest Case 6 MsgBox(64, "Restoring configuration", "Anime DB 2.0 will now be restored to defaults. The program will automatically restart.") ConsoleWrite("Deleting configuration file"&@CRLF) FileDelete("data\cfg.ini") Run("restoreadb.exe") ;don't forget to edit the source of restoreadb Case 7 ConsoleWrite("User opted for manual reconfiguration."&@CRLF) MsgBox(48, "Warning", "Anime DB 2.0 aborted the loading process because the save file was corrupt. The program will now close.") Exit EndSwitch EndSwitch ConsoleWrite("Configuration loaded."&@CRLF) Switch $updateOnLaunch Case 1 ConsoleWrite("Updating lists."&@CRLF) Local $list_of_anime_folders = _RecFileListToArray($defaultVideoDir, "*") $numberOfAnimes=$list_of_anime_folders[0] For $i=1 To UBound($list_of_anime_folders)-1 Step 1 GUICtrlSetData($animeList, $list_of_anime_folders[$i]&"|") Switch FileExists("data\"&$list_of_anime_folders[$i]) Case 0 ConsoleWrite("Creating data folder for new entry '"&$list_of_anime_folders[$i]&"'"&@CRLF) DirCreate("data\"&StringLower($list_of_anime_folders[$i])) IniWrite("data\"&StringLower($list_of_anime_folders[$i])&"\data.ini", "main", "rating", 0) IniWrite("data\"&StringLower($list_of_anime_folders[$i])&"\data.ini", "main", "picture","cover.bmp") EndSwitch Next ConsoleWrite("Done updating anime list."&@CRLF) EndSwitch EndSwitch Func updateSeasonsList() ;~ ConsoleWrite("Hidden control state value: "&$GUI_HIDE&"; Visible control state value: "&$GUI_SHOW&@CRLF) ;~ ConsoleWrite("animeList status: "&GUICtrlGetState($animeList)&@CRLF&"seasonList status: "&GUICtrlGetState($seasonList)&@CRLF&"episodeList status: "&GUICtrlGetState($episodesList)&@CRLF) $currentSelection=_GUICtrlListBox_GetCurSel($animeList)+1 Local $list_of_selected_anime_seasons = _RecFileListToArray($defaultVideoDir&"\"&GUICtrlRead($animeList), "*") ConsoleWrite("Updating list 2."&@CRLF) GUICtrlSetData($seasonList, "") For $i=1 To UBound($list_of_selected_anime_seasons)-1 Step 1 GUICtrlSetData($seasonList, $list_of_selected_anime_seasons[$i]&"|") IniWrite("data\"&StringLower(GUICtrlread($animeList))&"\data.ini", "main", $list_of_selected_anime_seasons[$i]&"_rating", 0) Next ;~ ConsoleWrite("selected: "&$currentSelection&@CRLF) ConsoleWrite("Updated list 2."&@CRLF) EndFunc Func updateEpisodesList() EndFunc Func switchStatus1() If GUICtrlRead($Checkbox1) == $GUI_CHECKED Then GUICtrlSetState($Checkbox2, $GUI_DISABLE) GUICtrlSetData($Checkbox2, $GUI_UNCHECKED) Else GUICtrlSetState($Checkbox2, $GUI_ENABLE) EndIf EndFunc Func switchStatus2() If GUICtrlRead($Checkbox2) == $GUI_CHECKED Then GUICtrlSetState($Checkbox1, $GUI_DISABLE) GUICtrlSetData($Checkbox1, $GUI_UNCHECKED) Else GUICtrlSetState($Checkbox1, $GUI_ENABLE) EndIf EndFunc Func checkOK($forceError=0) Switch $forceError Case 0 Local $error=0 If FileExists(GUICtrlRead($iVideoDir)) == 0 Then GUICtrlSetImage($videoDirPic, "") GUICtrlSetImage($videoDirPic, "res\no.bmp") $error=$error+1 Else GUICtrlSetImage($videoDirPic, "") GUICtrlSetImage($videoDirPic, "res\ok.bmp") EndIf If StringIsAlpha(GUICtrlRead($Input1)) == 1 And StringLen(GUICtrlRead($Input1)) == 1 Then GUICtrlSetImage($Pic1, "") GUICtrlSetImage($Pic1, "res\ok.bmp") Else GUICtrlSetImage($Pic1, "") GUICtrlSetImage($Pic1, "res\no.bmp") $error=$error+2 EndIf If (GUICtrlRead($Radio1) Or GUICtrlRead($Radio2)) Then Switch GUICtrlRead($Radio1) Case $GUI_CHECKED If FileExists("C:\Program Files (x86)\Windows Media Player\wmplayer.exe") == 0 Then $error=4 GUICtrlSetImage($Pic2, "") GUICtrlSetImage($Pic2, "res\no.bmp") EndIf EndSwitch Switch GUICtrlRead($Radio2) Case $GUI_CHECKED If FileExists("C:\Program Files (x86)\VideoLAN\VLC\vlc.exe") == 0 Then Switch FileExists("C:\Program Files (x86)\VideoLAN\VLC\vlc.exe") Case 0 $error=5 GUICtrlSetImage($Pic2, "") GUICtrlSetImage($Pic2, "res\no.bmp") Case Else GUICtrlSetImage($Pic2, "") GUICtrlSetImage($Pic2, "res\ok.bmp") EndSwitch Else GUICtrlSetImage($Pic2, "") GUICtrlSetImage($Pic2, "res\ok.bmp") EndIf EndSwitch Else GUICtrlSetImage($Pic2, "") GUICtrlSetImage($Pic2, "res\no.bmp") $error=$error+3 EndIf Case 1 $error="forced" EndSwitch Return $error EndFunc Func browseVideoDir() Local $brw=FileSelectFolder("Select the default video folder to use.", "") If @error Then ConsoleWrite("abort"&@CRLF) Else GUICtrlSetData($iVideoDir, $brw) EndIf checkOK() EndFunc Func close() If $firstRun==False Then Exit EndFunc Func closeSettings() If $firstRun == False Then GUISetState(@SW_HIDE, $Form2) Else MsgBox(16, "Error", "You need to configure the program first!") EndIf EndFunc Func star1() If $canBeRated Then ConsoleWrite("Updating rating for anime "&GUICtrlRead($animeList)&@CRLF) $currentRating=1 IniWrite("data\"&StringLower(GUICtrlRead($animeList))&"\data.ini", "main", "rating", $currentRating) forceUpdate() EndIf EndFunc Func star2() If $canBeRated Then ConsoleWrite("Updating rating for anime "&GUICtrlRead($animeList)&@CRLF) $currentRating=2 IniWrite("data\"&StringLower(GUICtrlRead($animeList))&"\data.ini", "main", "rating", $currentRating) forceUpdate() EndIf EndFunc Func star3() If $canBeRated Then ConsoleWrite("Updating rating for anime "&GUICtrlRead($animeList)&@CRLF) $currentRating=3 IniWrite("data\"&StringLower(GUICtrlRead($animeList))&"\data.ini", "main", "rating", $currentRating) forceUpdate() EndIf EndFunc Func star4() If $canBeRated Then ConsoleWrite("Updating rating for anime "&GUICtrlRead($animeList)&@CRLF) $currentRating=4 IniWrite("data\"&StringLower(GUICtrlRead($animeList))&"\data.ini", "main", "rating", $currentRating) forceUpdate() EndIf EndFunc Func star5() If $canBeRated Then ConsoleWrite("Updating rating for anime "&GUICtrlRead($animeList)&@CRLF) $currentRating=5 IniWrite("data\"&StringLower(GUICtrlRead($animeList))&"\data.ini", "main", "rating", $currentRating) forceUpdate() EndIf EndFunc Func openSettingsWindow() GUISetState(@SW_SHOW, $Form2) EndFunc Func saveAndClose() Local $result=checkOK() Switch $result Case 0 $configured=True GUISetState(@SW_HIDE, $Form2) IniWrite("data\cfg.ini", "main", "sv.VideoDirectory", GUICtrlRead($iVideoDir)) IniWrite("data\cfg.ini", "keys", "hk.InterruptPlaylist", StringUpper(GUICtrlRead($Input1))) Switch GUICtrlRead($Checkbox1) Case $GUI_CHECKED IniWrite("data\cfg.ini", "lists", "bv.UpdateOnLaunch", 1) Case Else IniWrite("data\cfg.ini", "lists", "bv.UpdateOnLaunch", 0) EndSwitch Switch GUICtrlRead($Checkbox2) Case $GUI_CHECKED IniWrite("data\cfg.ini", "lists", "bv.AskUpdateOnLaunch", 1) Case Else IniWrite("data\cfg.ini", "lists", "bv.AskUpdateOnLaunch", 0) EndSwitch Switch GUICtrlread($Checkbox3) Case $GUI_CHECKED IniWrite("data\cfg.ini", "media", "bv.AutomaticResume", 1) case Else IniWrite("data\cfg.ini", "media", "bv.AutomaticResume", 0) EndSwitch Switch GUICtrlRead($Radio1) Case $GUI_CHECKED IniWrite("data\cfg.ini", "media", "sv.MediaAgent", "WMP") Case Else IniWrite("data\cfg.ini", "media", "sv.MediaAgent", "VLC") EndSwitch Case 1 MsgBox(16, "Error", "Invalid directory.") Case 2 MsgBox(16, "Error", "You can't use "&GUICtrlRead($Input1)&" as a playlist-breaking key. Only alphabetical characters allowed (no space). Use the OK button to verify if the key you want can be used.") Case 3 MsgBox(16, "Error", "No media player selected.") Case Else MsgBox(16, "Error ["&$result&"]", "Some fields weren't filled or were filled with invalid data. Please remember that the given directory MUST be valid and that the key you use must consist of a single alphabetical character.") EndSwitch EndFunc Func discardAndClose() Switch $firstRun Case True MsgBox(16, "Error", "You need to configure the program first!") Case Else $configured=True GUISetState(@SW_HIDE, $Form2) EndSwitch EndFunc Func forceUpdate() Local $stars[5] $stars[0] = $star1 $stars[1] = $star2 $stars[2] = $star3 $stars[3] = $star4 $stars[4] = $star5 Switch $currentRating Case 0 GUICtrlSetImage($star1, "res\passive_square.bmp") GUICtrlSetImage($star2, "res\passive_square.bmp") GUICtrlSetImage($star3, "res\passive_square.bmp") GUICtrlSetImage($star4, "res\passive_square.bmp") GUICtrlSetImage($star5, "res\passive_square.bmp") Case 1 GUICtrlSetImage($star1, "res\selected_square.bmp") For $i = 1 To 4 Step 1 GUICtrlSetImage($stars[$i], "res\passive_square.bmp") Next Case 2 GUICtrlSetImage($star1, "res\selected_square.bmp") GUICtrlSetImage($star2, "res\selected_square.bmp") For $i = 2 To 4 Step 1 GUICtrlSetImage($stars[$i], "res\passive_square.bmp") Next Case 3 GUICtrlSetImage($star1, "res\selected_square.bmp") GUICtrlSetImage($star2, "res\selected_square.bmp") GUICtrlSetImage($star3, "res\selected_square.bmp") For $i = 3 To 4 Step 1 GUICtrlSetImage($stars[$i], "res\passive_square.bmp") Next Case 4 GUICtrlSetImage($star1, "res\selected_square.bmp") GUICtrlSetImage($star2, "res\selected_square.bmp") GUICtrlSetImage($star3, "res\selected_square.bmp") GUICtrlSetImage($star4, "res\selected_square.bmp") GUICtrlSetImage($star5, "res\passive_square.bmp") Case 5 GUICtrlSetImage($star1, "res\selected_square.bmp") GUICtrlSetImage($star2, "res\selected_square.bmp") GUICtrlSetImage($star3, "res\selected_square.bmp") GUICtrlSetImage($star4, "res\selected_square.bmp") GUICtrlSetImage($star5, "res\selected_square.bmp") EndSwitch EndFunc ;===================> forceUpdate While 1 $currentTab=_GUICtrlTab_GetCurSel($oTab1) Switch $currentSelection Case 0 $canBeRated=False Case Else Local $animeName = GUICtrlRead($animeList) $canBeRated=True $currentRating=IniRead("data\"&StringLower($animeName)&"\data.ini", "main", "rating", 0) EndSwitch Switch $canBeRated Case True ; Allow stars to be selected, making them golden [aka STARS_SELECT] Local $stars[5] $stars[0] = $star1 $stars[1] = $star2 $stars[2] = $star3 $stars[3] = $star4 $stars[4] = $star5 Switch $currentRating Case 0 GUICtrlSetImage($star1, "res\passive_square.bmp") GUICtrlSetImage($star2, "res\passive_square.bmp") GUICtrlSetImage($star3, "res\passive_square.bmp") GUICtrlSetImage($star4, "res\passive_square.bmp") GUICtrlSetImage($star5, "res\passive_square.bmp") Case 1 GUICtrlSetImage($star1, "res\selected_square.bmp") For $i = 1 To 4 Step 1 GUICtrlSetImage($stars[$i], "res\passive_square.bmp") Next Case 2 GUICtrlSetImage($star1, "res\selected_square.bmp") GUICtrlSetImage($star2, "res\selected_square.bmp") For $i = 2 To 4 Step 1 GUICtrlSetImage($stars[$i], "res\passive_square.bmp") Next Case 3 GUICtrlSetImage($star1, "res\selected_square.bmp") GUICtrlSetImage($star2, "res\selected_square.bmp") GUICtrlSetImage($star3, "res\selected_square.bmp") For $i = 3 To 4 Step 1 GUICtrlSetImage($stars[$i], "res\passive_square.bmp") Next Case 4 GUICtrlSetImage($star1, "res\selected_square.bmp") GUICtrlSetImage($star2, "res\selected_square.bmp") GUICtrlSetImage($star3, "res\selected_square.bmp") GUICtrlSetImage($star4, "res\selected_square.bmp") GUICtrlSetImage($star5, "res\passive_square.bmp") Case 5 GUICtrlSetImage($star1, "res\selected_square.bmp") GUICtrlSetImage($star2, "res\selected_square.bmp") GUICtrlSetImage($star3, "res\selected_square.bmp") GUICtrlSetImage($star4, "res\selected_square.bmp") GUICtrlSetImage($star5, "res\selected_square.bmp") EndSwitch ; ===============================================================================> STARS_SELECT ; Update the stars when mouse hovers over them [aka STARS_UPDATE] $mouseHoverOn=GUIGetCursorInfo($Form1) If $mouseHoverOn[4] > ($star1)-1 and $mouseHoverOn[4] < ($star5)+1 Then Switch $mouseHoverOn[4] Case $star1 While $mouseHoverOn[4] == $star1 $mouseHoverOn=GUIGetCursorInfo($Form1) If $currentRating < 1 Then GUICtrlSetImage($star1, "res\active_square.bmp") WEnd If $currentRating < 1 Then GUICtrlSetImage($star1, "res\passive_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\passive_square.bmp") If $currentRating < 3 Then GUICtrlSetImage($star3, "res\passive_square.bmp") If $currentRating < 4 Then GUICtrlSetImage($star4, "res\passive_square.bmp") If $currentRating < 5 Then GUICtrlSetImage($star5, "res\passive_square.bmp") Case $star2 While $mouseHoverOn[4] == $star2 $mouseHoverOn=GUIGetCursorInfo($Form1) If $currentRating < 1 Then GUICtrlSetImage($star1, "res\active_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\active_square.bmp") WEnd If $currentRating < 1 Then GUICtrlSetImage($star1, "res\passive_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\passive_square.bmp") If $currentRating < 3 Then GUICtrlSetImage($star3, "res\passive_square.bmp") If $currentRating < 4 Then GUICtrlSetImage($star4, "res\passive_square.bmp") If $currentRating < 5 Then GUICtrlSetImage($star5, "res\passive_square.bmp") Case $star3 While $mouseHoverOn[4] == $star3 $mouseHoverOn=GUIGetCursorInfo($Form1) If $currentRating < 1 Then GUICtrlSetImage($star1, "res\active_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\active_square.bmp") If $currentRating < 3 Then GUICtrlSetImage($star3, "res\active_square.bmp") WEnd If $currentRating < 1 Then GUICtrlSetImage($star1, "res\passive_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\passive_square.bmp") If $currentRating < 3 Then GUICtrlSetImage($star3, "res\passive_square.bmp") If $currentRating < 4 Then GUICtrlSetImage($star4, "res\passive_square.bmp") If $currentRating < 5 Then GUICtrlSetImage($star5, "res\passive_square.bmp") Case $star4 While $mouseHoverOn[4] == $star4 $mouseHoverOn=GUIGetCursorInfo($Form1) If $currentRating < 1 Then GUICtrlSetImage($star1, "res\active_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\active_square.bmp") If $currentRating < 3 Then GUICtrlSetImage($star3, "res\active_square.bmp") If $currentRating < 4 Then GUICtrlSetImage($star4, "res\active_square.bmp") WEnd If $currentRating < 1 Then GUICtrlSetImage($star1, "res\passive_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\passive_square.bmp") If $currentRating < 3 Then GUICtrlSetImage($star3, "res\passive_square.bmp") If $currentRating < 4 Then GUICtrlSetImage($star4, "res\passive_square.bmp") If $currentRating < 5 Then GUICtrlSetImage($star5, "res\passive_square.bmp") Case $star5 While $mouseHoverOn[4] == $star5 $mouseHoverOn=GUIGetCursorInfo($Form1) If $currentRating < 1 Then GUICtrlSetImage($star1, "res\active_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\active_square.bmp") If $currentRating < 3 Then GUICtrlSetImage($star3, "res\active_square.bmp") If $currentRating < 4 Then GUICtrlSetImage($star4, "res\active_square.bmp") If $currentRating < 5 Then GUICtrlSetImage($star5, "res\active_square.bmp") WEnd If $currentRating < 1 Then GUICtrlSetImage($star1, "res\passive_square.bmp") If $currentRating < 2 Then GUICtrlSetImage($star2, "res\passive_square.bmp") If $currentRating < 3 Then GUICtrlSetImage($star3, "res\passive_square.bmp") If $currentRating < 4 Then GUICtrlSetImage($star4, "res\passive_square.bmp") If $currentRating < 5 Then GUICtrlSetImage($star5, "res\passive_square.bmp") EndSwitch EndIf ; ===============================================================================> STARS_UPDATE EndSwitch If $currentTab==0 And GUICtrlGetState($animeList) == 96 Then GUICtrlSetState($animeList, 80) ConsoleWrite("1st:on, ") GUICtrlSetState($seasonList, 96) ConsoleWrite("2nd:off, ") GUICtrlSetState($episodesList, 96) ConsoleWrite("3rd:off.") ConsoleWrite(" Currently counting "&_GUICtrlListBox_GetCount($animeList)&" items in 1st list."&@CRLF) EndIf If $currentTab==1 And GUICtrlGetState($seasonList) == 96 Then GUICtrlSetState($animeList, 96) ConsoleWrite("1st:off, ") GUICtrlSetState($seasonList, 80) ConsoleWrite("2nd:on, ") GUICtrlSetState($episodesList, 96) ConsoleWrite("3rd:off.") ConsoleWrite(" Currently counting "&_GUICtrlListBox_GetCount($seasonList)&" items in 2nd list."&@CRLF) EndIf ;~ For $i=0 To 100 Step 1 ;~ GUICtrlSetData($seasonList, $i&"|") ;~ Next ;~ For $i=0 To _GUICtrlListBox_GetCount($seasonList)-1 Step 1 ;~ _GUICtrlListBox_SetCurSel($seasonList, $i) ;~ ConsoleWrite(GUICtrlRead($seasonList)&@CRLF) ;~ Next ;~ EndIf If $currentTab==2 And GUICtrlGetState($episodesList) == 96 Then GUICtrlSetState($animeList, 96) ConsoleWrite("1st:off, ") GUICtrlSetState($seasonList, 96) ConsoleWrite("2nd:off, ") GUICtrlSetState($episodesList, 80) ConsoleWrite("3rd:on.") ConsoleWrite(" Currently counting "&_GUICtrlListBox_GetCount($episodesList)&" items in 3rd list."&@CRLF) EndIf WEndMight be better here http://pastebin.com/DLw2rj8QDon't mind the other errors, I'm aware of them (some are caused to me using an older version of autoit when writing this :/) Edited March 3, 2013 by megablox "The story of a blade is linked in Blood." ―Yasuo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 3, 2013 Moderators Share Posted March 3, 2013 megablox, It is difficult to run your script as it seems very closely tied to your folder setup, but the intitial GUI creation code offers a good clue as to why you are having problems with the list controls and the tabs. You need to create the list controls inside the correct part of the tab structure - at the moment you are creating both the "Seasons" and "Episodes" lists on the final tab. Try this code and see if it fixes the problem: $oTab1 = GUICtrlCreateTab(0, 0, 417, 329) $tList = GUICtrlCreateTabItem("List of animes") $animeList = GUICtrlCreateList("", 8, 32, 401, 280, BitOR($LBS_NOTIFY, $LBS_SORT, $WS_VSCROLL), 0) GUICtrlSetOnEvent(-1, "updateSeasonsList") GUICtrlSetFont(-1, 8, 400, 0, "Arial") $tSeasons = GUICtrlCreateTabItem("Seasons") $seasonList = GUICtrlCreateList("", 8, 32, 401, 280, BitOR($LBS_NOTIFY, $LBS_SORT, $WS_VSCROLL), 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $tEpisodes = GUICtrlCreateTabItem("Episodes") $episodesList = GUICtrlCreateList("", 8, 32, 401, 280, BitOR($LBS_NOTIFY, $LBS_SORT, $WS_VSCROLL), 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlCreateTabItem("") Any luck? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Khryus Posted March 3, 2013 Author Share Posted March 3, 2013 Yep, that worked ! I generated the GUI code with koda - might have modified it though. I'm messy Thanks - I'll proceed on fixing the other errors now "The story of a blade is linked in Blood." ―Yasuo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 3, 2013 Moderators Share Posted March 3, 2013 megablox, Excellent - glad I could help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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