m4k4n Posted February 26, 2013 Posted February 26, 2013 (edited) Hi Guys, first i want to say thank you. I found almost everything in this forum except for this. I'm having trouble setting the color of a Combobox item... I could change the caption, but this will actually interfere with other functions. So basically what i want to do is, color a Item if a value is true. Func LoadShow() Local $TVShowNames = IniReadSectionNames("TVJunkieData.ini") ;~ For $i = 1 To $TVShowNames[0] ;~ If IniRead("TVJunkieData.ini", $TVShowNames[$i] , "FlagD", "0") = 0 Then ;~ $TVShowNames[$i] = $TVShowNames[$i] ;~ ElseIf IniRead("TVJunkieData.ini", $TVShowNames[$i] , "FlagD", "0") = "S+" Then ;~ $TVShowNames[$i] = $TVShowNames[$i] & " --- NEW ---" ;~ Else ;~ $TVShowNames[$i] = $TVShowNames[$i] & " --- NEW ---" ;~ EndIf ;~ Next If $TVShowNames[0] > 10 Then $showdat = _ArrayToString($TVShowNames) $showdat2 = StringTrimLeft($showdat, 3) Else $showdat = _ArrayToString($TVShowNames) $showdat2 = StringTrimLeft($showdat, 2) EndIf GuiCtrlSetData($Combo1, "|" & $showdat2, "TV Show") ;ConsoleWrite(StringReplace(GUICtrlRead($Combo1), " --- NEW ---", "")) ReadEpisodes() CheckFlag() EndFunc I checked the forum for this but couldn't really find it. Does anyone have an idea? I would really appreciate it. Edited March 4, 2013 by m4k4n
Nessie Posted February 26, 2013 Posted February 26, 2013 (edited) Something like this? expandcollapse popup#include <GuiComboBoxEx.au3> #include <GuiImageList.au3> #include <GuiConstantsEx.au3> Opt('MustDeclareVars', 1) $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work Global $iMemo _Main() Func _Main() Local $hGUI, $hImage, $hCombo,$bmp ; Create GUI $hGUI = GUICreate("ComboBoxEx Set Image List", 400, 300) $hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100) $iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() $hImage = _GUIImageList_Create (20, 12, 5, 3) Local $List[7][2] = [ _ ["ROT",0xFF0000] , _ ["Grün",0x00FF00] , _ ["Blau",0x0000FF] , _ ["Gelb",0xFFFF00] , _ ["cyan",0x00FFFF] , _ ["Weiß",0xFFFFFF] , _ ["Schwarz",0x000000] ] ;Set Image List _GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage) ; Add Items For $i = 0 To UBound($List)-1 $bmp = _IMGListAddColor($hImage,$List[$i][1],20,12) _GUICtrlComboBoxEx_AddString ($hCombo, $List[$i][0], $bmp, $bmp) Next Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Prog@ndy Func _IMGListAddColor($hImage,$Color,$W=16,$H=16) Local $bmp = _WinAPI_CreateSolidBitMap (_WinAPI_GetDesktopWindow(), $Color,$W,$H) Local $index = _GUIImageList_Add ($hImage,$bmp) _WinAPI_DeleteObject($bmp) Return $index EndFunc Hi! Edited February 26, 2013 by Nessie My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
m4k4n Posted February 26, 2013 Author Posted February 26, 2013 Hi Nessie, thanks for the Reply. Ive seen that already but i wanted to avoid putting a image beside my string.
Nessie Posted February 26, 2013 Posted February 26, 2013 (edited) Take a look to this : expandcollapse popup#include <GUIComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global Const $ODT_MENU = 1 Global Const $ODT_LISTBOX = 2 Global Const $ODT_COMBOBOX = 3 Global Const $ODT_BUTTON = 4 Global Const $ODT_STATIC = 5 Global Const $ODT_HEADER = 100 Global Const $ODT_TAB = 101 Global Const $ODT_LISTVIEW = 102 Global Const $ODA_DRAWENTIRE = 1 Global Const $ODA_SELECT = 2 Global Const $ODA_FOCUS = 4 Global Const $ODS_SELECTED = 1 Global Const $ODS_GRAYED = 2 Global Const $ODS_DISABLED = 4 Global Const $ODS_CHECKED = 8 Global Const $ODS_FOCUS = 16 Global Const $ODS_DEFAULT = 32 Global Const $ODS_HOTLIGHT = 64 Global Const $ODS_INACTIVE = 128 Global Const $ODS_NOACCEL = 256 Global Const $ODS_NOFOCUSRECT = 512 Global Const $ODS_COMBOBOXEDIT = 4096 Global Const $clrWindowText = _WinAPI_GetSysColor($COLOR_WINDOWTEXT) Global Const $clrHighlightText = _WinAPI_GetSysColor($COLOR_HIGHLIGHTTEXT) Global Const $clrHightlight = _WinAPI_GetSysColor($COLOR_HIGHLIGHT) Global Const $clrWindow = _WinAPI_GetSysColor($COLOR_WINDOW) Global Const $tagDRAWITEMSTRUCT = _ 'uint CtlType;' & _ 'uint CtlID;' & _ 'uint itemID;' & _ 'uint itemAction;' & _ 'uint itemState;' & _ 'hwnd hwndItem;' & _ 'hwnd hDC;' & _ $tagRECT & _ ';ulong_ptr itemData;' Global Const $tagMEASUREITEMSTRUCT = _ 'uint CtlType;' & _ 'uint CtlID;' & _ 'uint itemID;' & _ 'uint itemWidth;' & _ 'uint itemHeight;' & _ 'ulong_ptr itemData;' Global $hGUI Global $ComboBox Global $sStr = '' $hGUI = GUICreate('Test', 200, 200) $ComboBox = GUICtrlCreateCombo('', 0, 0, 200, 200, BitOR($WS_CHILD, $CBS_OWNERDRAWFIXED, $CBS_HASSTRINGS, $CBS_DROPDOWNLIST)) For $i = 1 To 20 $sStr &= 'String ' & $i & '|' Next GUICtrlSetData($ComboBox, StringTrimRight($sStr, 1)) ;~ GUIRegisterMsg($WM_MEASUREITEM, '_WM_MEASUREITEM') GUIRegisterMsg($WM_DRAWITEM, '_WM_DRAWITEM') GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Exit ;~ Func _WM_MEASUREITEM($hWnd, $iMsg, $iwParam, $ilParam) ;~ Local $tMIS = DllStructCreate($tagMEASUREITEMSTRUCT, $ilParam) ;~ Local $iCtrl, $iType, $iItem ;~ ;~ Return $GUI_RUNDEFMSG ;~ EndFunc Func _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilParam) Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilParam) Local $iCtlType, $iCtlID, $iItemID, $iItemAction, $iItemState Local $clrForeground, $clrBackground Local $hWndItem, $hDC Local $tRect Local $sText $iCtlType = DllStructGetData($tDIS, 'CtlType') $iCtlID = DllStructGetData($tDIS, 'CtlID') $iItemID = DllStructGetData($tDIS, 'itemID') $iItemAction = DllStructGetData($tDIS, 'itemAction') $iItemState = DllStructGetData($tDIS, 'itemState') $hWndItem = DllStructGetData($tDIS, 'hwndItem') $hDC = DllStructGetData($tDIS, 'hDC') $tRect = DllStructCreate($tagRECT) If $iCtlType = $ODT_COMBOBOX And $iCtlID = $ComboBox Then Switch $iItemAction Case $ODA_DRAWENTIRE For $i = 1 To 4 DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i+7)) Next _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText) $clrForeground = _WinAPI_SetTextColor($hDC, Random(13369344, 13434879, 1)) If BitAND($iItemState, $ODS_SELECTED) Then $clrBackground = _WinAPI_SetBkColor($hDC, $clrHightlight) Else $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow) EndIf _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT) _WinAPI_SetTextColor($hDC, $clrForeground) _WinAPI_SetBkColor($hDC, $clrBackground) Case $ODA_SELECT For $i = 1 To 4 DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i+7)) Next _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText) $clrForeground = _WinAPI_SetTextColor($hDC, Random(13369344, 13434879, 1)) If BitAND($iItemState, $ODS_SELECTED) Then $clrBackground = _WinAPI_SetBkColor($hDC, $clrHightlight) Else $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow) EndIf _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT) _WinAPI_SetTextColor($hDC, $clrForeground) _WinAPI_SetBkColor($hDC, $clrBackground) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc Hi! Edited February 26, 2013 by Nessie My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
m4k4n Posted February 26, 2013 Author Posted February 26, 2013 hm, this actually looks good, gotta take a better look at it, thanks!
Nessie Posted February 26, 2013 Posted February 26, 2013 No problem, if you want more help don't esitate to ask Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
guinness Posted February 26, 2013 Posted February 26, 2013 Where did you get those constants from? UDF List: Reveal hidden contents _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Nessie Posted February 26, 2013 Posted February 26, 2013 I have this code in my snippet, by the way i have found the topic from where I took the code:Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
guinness Posted February 26, 2013 Posted February 26, 2013 OK, I didn't know if you had uncovered them from some AutoIt UDF as I was going to say just include the file instead. UDF List: Reveal hidden contents _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
m4k4n Posted March 2, 2013 Author Posted March 2, 2013 (edited) Hi Guys, i got finally time to start coding again. I have just one Problem. It seems that _WinAPI_SetTextColor cannot set the color for a specific item. So i tried to create each Item on its own. Doenst work either Does anyone has an idea how to solve my problem ? I would really appreciate it. Thanks! Here is the code i use: expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <Array.au3> #include <File.au3> #include <ProgressConstants.au3> #include <GUIComboBox.au3> #include <WinAPI.au3> Global Const $ODT_MENU = 1 Global Const $ODT_LISTBOX = 2 Global Const $ODT_COMBOBOX = 3 Global Const $ODT_BUTTON = 4 Global Const $ODT_STATIC = 5 Global Const $ODT_HEADER = 100 Global Const $ODT_TAB = 101 Global Const $ODT_LISTVIEW = 102 Global Const $ODA_DRAWENTIRE = 1 Global Const $ODA_SELECT = 2 Global Const $ODA_FOCUS = 4 Global Const $ODS_SELECTED = 1 Global Const $ODS_GRAYED = 2 Global Const $ODS_DISABLED = 4 Global Const $ODS_CHECKED = 8 Global Const $ODS_FOCUS = 16 Global Const $ODS_DEFAULT = 32 Global Const $ODS_HOTLIGHT = 64 Global Const $ODS_INACTIVE = 128 Global Const $ODS_NOACCEL = 256 Global Const $ODS_NOFOCUSRECT = 512 Global Const $ODS_COMBOBOXEDIT = 4096 Global Const $clrWindowText = _WinAPI_GetSysColor($COLOR_WINDOWTEXT) Global Const $clrHighlightText = _WinAPI_GetSysColor($COLOR_HIGHLIGHTTEXT) Global Const $clrHightlight = _WinAPI_GetSysColor($COLOR_HIGHLIGHT) Global Const $clrWindow = _WinAPI_GetSysColor($COLOR_WINDOW) Global Const $tagDRAWITEMSTRUCT = _ 'uint CtlType;' & _ 'uint CtlID;' & _ 'uint itemID;' & _ 'uint itemAction;' & _ 'uint itemState;' & _ 'hwnd hwndItem;' & _ 'hwnd hDC;' & _ $tagRECT & _ ';ulong_ptr itemData;' Global Const $tagMEASUREITEMSTRUCT = _ 'uint CtlType;' & _ 'uint CtlID;' & _ 'uint itemID;' & _ 'uint itemWidth;' & _ 'uint itemHeight;' & _ 'ulong_ptr itemData;' Global $hGUI Global $Combo1 Global $sStr = '' ;GUI $Form1_1 = GUICreate("m4k4n's TVShow Junkie!", 383, 263, 254, 261) $List1 = GUICtrlCreateList("", 8, 56, 113, 201, 0xA30001) GUICtrlSetData(-1, "") GUICtrlSetFont(-1, 8, 400, 0, "Calibri") $Combo1 = GUICtrlCreateCombo("", 8, 6, 113, 25, BitOR($WS_CHILD, $CBS_OWNERDRAWFIXED, $CBS_HASSTRINGS, $CBS_DROPDOWNLIST)) GUICtrlSetFont(-1, 8, 400, 0, "Calibri") $Combo2 = GUICtrlCreateCombo("Seasons", 8, 32, 113, 25) GUICtrlSetFont(-1, 8, 400, 0, "Calibri") $Button1 = GUICtrlCreateButton("Open TVShow", 240, 6, 137, 49) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Button2 = GUICtrlCreateButton("Update all", 240, 56, 137, 49) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Button3 = GUICtrlCreateButton("Set Flag", 240, 106, 137, 49) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Button4 = GUICtrlCreateButton("Enter new TV Series", 240, 156, 137, 49) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Button5 = GUICtrlCreateButton("Delete Selected", 240, 207, 137, 49) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Group1 = GUICtrlCreateGroup("Menu", 128, 0, 105, 169) GUICtrlSetFont(-1, 8, 400, 0, "Calibri") $Progress1 = GUICtrlCreateProgress(137, 16, 86, 17) $Input1 = GUICtrlCreateInput("", 136, 58, 89, 21) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Label1 = GUICtrlCreateLabel("Show Name:", 136, 40, 62, 17) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Label2 = GUICtrlCreateLabel("Link:", 136, 81, 26, 17) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Input2 = GUICtrlCreateInput("", 136, 98, 89, 21) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Label6 = GUICtrlCreateLabel("TVShow end?", 136, 121, 82, 17) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Combo3 = GUICtrlCreateCombo("", 136, 138, 57, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") GUICtrlSetData ($Combo3, "No|Yes", "No") GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Group2 = GUICtrlCreateGroup("Info", 128, 168, 105, 89) GUICtrlSetFont(-1, 8, 400, 0, "Calibri") $Label3 = GUICtrlCreateLabel("You are currently at", 133, 184, 96, 17) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Label4 = GUICtrlCreateLabel("", 157, 202, 62, 17) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Label5 = GUICtrlCreateLabel("", 157, 217, 71, 17) GUICtrlSetFont(-1, 9, 400, 0, "Calibri") $Label7 = GUICtrlCreateLabel("", 136, 236, 92, 17) GUICtrlSetFont(-1, 8.7, 400, 0, "Calibri") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_DRAWITEM, '_WM_DRAWITEM') onload() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func onload() Local $TVShowNames = IniReadSectionNames("TVJunkieData.ini") If $TVShowNames[0] > 10 Then $showdat = _ArrayToString($TVShowNames) $sStr = StringTrimLeft($showdat, 3) Else $showdat = _ArrayToString($TVShowNames) $sStr = StringTrimLeft($showdat, 2) EndIf GuiCtrlSetData($Combo1, "|" & $sStr, "TV Show") EndFunc Func _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilParam) Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilParam) Local $iCtlType, $iCtlID, $iItemID, $iItemAction, $iItemState Local $clrBackground Local $hWndItem, $hDC Local $tRect Local $sText Local $TVShowNames = IniReadSectionNames("TVJunkieData.ini") $iCtlType = DllStructGetData($tDIS, 'CtlType') $iCtlID = DllStructGetData($tDIS, 'CtlID') $iItemID = DllStructGetData($tDIS, 'itemID') $iItemAction = DllStructGetData($tDIS, 'itemAction') $iItemState = DllStructGetData($tDIS, 'itemState') $hWndItem = DllStructGetData($tDIS, 'hwndItem') $hDC = DllStructGetData($tDIS, 'hDC') $tRect = DllStructCreate($tagRECT) If $iCtlType = $ODT_COMBOBOX And $iCtlID = $Combo1 Then Switch $iItemAction Case $ODA_DRAWENTIRE, $ODA_SELECT For $i = 1 To 4 DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i+7)) Next _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText) For $i2 = 1 To $TVShowNames[0] If IniRead("TVJunkieData.ini", $TVShowNames[$i2] , "FlagD", "0") = 0 Then $clrForeground = _WinAPI_SetTextColor($hDC, 0x2B0DF1) ElseIf IniRead("TVJunkieData.ini", $TVShowNames[$i2] , "FlagD", "0") = "S+" Then $clrForeground = _WinAPI_SetTextColor($hDC, 0xF10D0D) Else $clrForeground = _WinAPI_SetTextColor($hDC, 0xF10D0D) EndIf If BitAND($iItemState, $ODS_SELECTED) Then $clrBackground = _WinAPI_SetBkColor($hDC, $clrHightlight) Else $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow) EndIf _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT) _WinAPI_SetTextColor($hDC, $clrForeground) _WinAPI_SetBkColor($hDC, $clrBackground) Next EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc And an Example ini: [TV Show] 1=1 Link=Enter Link Seasons=1 FlagS=1 FlagE=1 End=No FlagD=0 [fsadfa6] FlagD=16 [fsadfa7] FlagD=16 [fsadfa8] FlagD=0 Edited March 4, 2013 by m4k4n
m4k4n Posted March 4, 2013 Author Posted March 4, 2013 Hi Guys, got it! I know it sucks if someone found a solution to a problem and wont post it. So here it is (Use the ini above) expandcollapse popupFunc _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilParam) Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilParam) Local $iCtlType, $iCtlID, $iItemID, $iItemAction, $iItemState Local $clrForeground, $clrBackground Local $hWndItem, $hDC Local $tRect Local $sText Local $TVShowNames = IniReadSectionNames("TVJunkieData.ini") $iCtlType = DllStructGetData($tDIS, 'CtlType') $iCtlID = DllStructGetData($tDIS, 'CtlID') $iItemID = DllStructGetData($tDIS, 'itemID') $iItemAction = DllStructGetData($tDIS, 'itemAction') $iItemState = DllStructGetData($tDIS, 'itemState') $hWndItem = DllStructGetData($tDIS, 'hwndItem') $hDC = DllStructGetData($tDIS, 'hDC') $tRect = DllStructCreate($tagRECT) Switch $iItemAction Case $ODA_DRAWENTIRE, $ODA_SELECT For $i = 1 To 4 DllStructSetData($tRect, $i, DllStructGetData($tDIS, $i + 7)) Next _GUICtrlComboBox_GetLBText($hWndItem, $iItemID, $sText) ;THIS ONE IS IMPORTANT For $i2 = 0 To $TVShowNames[0] If IniRead("TVJunkieData.ini", $TVShowNames[$i2] , "FlagD", "Not Found") <> 0 Then If $iItemID = $i2-1 Then $clrForeground = _WinAPI_SetTextColor($hDC, 0x0817A0);red EndIf EndIf Next If BitAND($iItemState, $ODS_SELECTED) Then $clrBackground = _WinAPI_SetBkColor($hDC, $clrHightlight) Else $clrBackground = _WinAPI_SetBkColor($hDC, $clrWindow) EndIf _WinAPI_DrawText($hDC, $sText, $tRect, $DT_LEFT) _WinAPI_SetTextColor($hDC, $clrForeground) _WinAPI_SetBkColor($hDC, $clrBackground) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_DRAWITEM
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