Loc Posted July 29, 2021 Share Posted July 29, 2021 i have more than 100 labels. when it changes color it will flash from top to bottom. how to make it recognize what color the current color is so that when changing the color it will not need to change the old color. like the function _guictrltab_setcurfocus() when i am at position 0 but i still use it at position 0, it does not change, and guictrlsetstate(, $gui_show) when it is at position 0 it still shows position 0 so it will flash. if you save its old color to a file for comparison, it's too verbose. sorry for my english not good Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 29, 2021 Moderators Share Posted July 29, 2021 Loc, Why save to a file? Why not keep the current colour value in an array during run-time? You would only need to read/save the values to file at start/end of the script. 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...
Loc Posted July 29, 2021 Author Share Posted July 29, 2021 (edited) My label here is the table number. It is distinguished by 3 colors. Empty table: Blue Table with people: Red Table is oder: White About the distinction to change these colors I save to file. It is working directly on the GUI so will have to check all tables to see which tables are empty, which are occupied and which are oder Edited July 29, 2021 by Melba23 Removed image Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 29, 2021 Moderators Share Posted July 29, 2021 Loc, That sounds as if an internal array is exactly what you need. You say that it "is working directly on the GUI" - does that mean that you click on the label to change the colour? If so then all you need to do is to check the current state and advance it to the next one. I have to take my grandchildren to "cantajuegos" (songs and dances for small children) in a few minutes, but I will try and produce something to show you how I think you might proceed later this evening. M23 Loc 1 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...
Moderators Melba23 Posted July 29, 2021 Moderators Share Posted July 29, 2021 Loc, Try this: expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> ; Arrays to hold table ControlIDs and states Global $aTables[5], $aState[5] ; Array of required colours Global $aColours[3] = [0x0000FF, 0xFF0000, 0xFFFFFF] $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xC4C4C4) ; Create the labels usign an algorithm For $i = 0 To 4 $aTables[$i] = GUICtrlCreateLabel($i + 1, ($i * 100) + 5, 5, 90, 90, BitOr($SS_NOTIFY, $SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont($aTables[$i], 24, 800) ; Ste intial colour GUICtrlSetColor($aTables[$i], 0xFF8000) GUICtrlSetBkColor($aTables[$i], $aColours[0]) Next GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ; Look for a table being clicked For $i = 0 To 4 If $iMsg = $aTables[$i] Then ; Increase table state - using Mod automatically resets to 0 when required $aState[$i] = Mod($aState[$i] + 1, 3) ; Now set table tot he correct colour GUICtrlSetBkColor($aTables[$i], $aColours[$aState[$i]]) ; No point in looking further ExitLoop EndIf Next WEnd How does that look? M23 Loc 1 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...
Loc Posted July 30, 2021 Author Share Posted July 30, 2021 I'm currently quarantined due to the corona virus so I don't have a PC to try 😰 Thank you M23 Musashi 1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 30, 2021 Moderators Share Posted July 30, 2021 Loc, Sorry to hear that. We will still be here when you are released. M23 Loc and Musashi 2 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...
Zedna Posted August 11, 2021 Share Posted August 11, 2021 (edited) To get color of label look here: Edited August 11, 2021 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search 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