Changing text color in Listview as the line of text is being displayed












0














I found references to changing text color but not with AutoHotKey. There seems to be a lot of LV modify options but nothing related to display color.



What I would like to do is to display a line of text in a color to be determined by one of the ListView column variable values as the line of text is put on screen.



Below is the some of the code. I've shortened the code for clarity but this should demonstrate what I want to do:



Gui, New ,, Basic List
Gui, Add, Text, x1, Location %AppLocation% Rec Count %NGCRec%
Gui, Add, ListView, VFirstGui H350 W256 gNGCSelect1 HScroll, Object Name|etc. etc
Gui, Add, Text,, Sort Options Siderial Time %SideHr%h etc. etc

While x < y
{
;If possible change text color here before the next line of text is displayed
LV_Add(, NGCSort%x%_11, NGCSort%x%_2, NGCSort%x%_5, NGCSort%x%_6, etc. etc)
x += 1
}


Sorry for the double spacing above but other wise all the text wraps together



I know I can set listview colors in Gui, Add, ListView, options but those colors cannot be changed while the ListView text is being put on screen.



If it is not possible to change the Listview line colors as they are being displayed Could I possibly save the contents of the display variable in different colors?



The variables in the LV_Add statement are NGCSort%x%_11, NGCSort%x%_2, and so on.



The values in those variable are read in from a text file then displayed on screen as black text.



Is there a way to save the text file value into the NGCSort%x%_%y% variables in color so that they will display in color rather than trying to change the colors as the line of text is being put on the screen?



The idea behind this is to give the viewer an idea of how close an astronomical object is to its highest position in the sky. Blue, the object is rising toward its highest point. Red it is near its highest point. Green it is setting down and away from its highest point.



I am not a professional programmer, just a retired technician trying to work in the old BASIC spaghetti code. Not very pretty but it usually works. :)










share|improve this question





























    0














    I found references to changing text color but not with AutoHotKey. There seems to be a lot of LV modify options but nothing related to display color.



    What I would like to do is to display a line of text in a color to be determined by one of the ListView column variable values as the line of text is put on screen.



    Below is the some of the code. I've shortened the code for clarity but this should demonstrate what I want to do:



    Gui, New ,, Basic List
    Gui, Add, Text, x1, Location %AppLocation% Rec Count %NGCRec%
    Gui, Add, ListView, VFirstGui H350 W256 gNGCSelect1 HScroll, Object Name|etc. etc
    Gui, Add, Text,, Sort Options Siderial Time %SideHr%h etc. etc

    While x < y
    {
    ;If possible change text color here before the next line of text is displayed
    LV_Add(, NGCSort%x%_11, NGCSort%x%_2, NGCSort%x%_5, NGCSort%x%_6, etc. etc)
    x += 1
    }


    Sorry for the double spacing above but other wise all the text wraps together



    I know I can set listview colors in Gui, Add, ListView, options but those colors cannot be changed while the ListView text is being put on screen.



    If it is not possible to change the Listview line colors as they are being displayed Could I possibly save the contents of the display variable in different colors?



    The variables in the LV_Add statement are NGCSort%x%_11, NGCSort%x%_2, and so on.



    The values in those variable are read in from a text file then displayed on screen as black text.



    Is there a way to save the text file value into the NGCSort%x%_%y% variables in color so that they will display in color rather than trying to change the colors as the line of text is being put on the screen?



    The idea behind this is to give the viewer an idea of how close an astronomical object is to its highest position in the sky. Blue, the object is rising toward its highest point. Red it is near its highest point. Green it is setting down and away from its highest point.



    I am not a professional programmer, just a retired technician trying to work in the old BASIC spaghetti code. Not very pretty but it usually works. :)










    share|improve this question



























      0












      0








      0







      I found references to changing text color but not with AutoHotKey. There seems to be a lot of LV modify options but nothing related to display color.



      What I would like to do is to display a line of text in a color to be determined by one of the ListView column variable values as the line of text is put on screen.



      Below is the some of the code. I've shortened the code for clarity but this should demonstrate what I want to do:



      Gui, New ,, Basic List
      Gui, Add, Text, x1, Location %AppLocation% Rec Count %NGCRec%
      Gui, Add, ListView, VFirstGui H350 W256 gNGCSelect1 HScroll, Object Name|etc. etc
      Gui, Add, Text,, Sort Options Siderial Time %SideHr%h etc. etc

      While x < y
      {
      ;If possible change text color here before the next line of text is displayed
      LV_Add(, NGCSort%x%_11, NGCSort%x%_2, NGCSort%x%_5, NGCSort%x%_6, etc. etc)
      x += 1
      }


      Sorry for the double spacing above but other wise all the text wraps together



      I know I can set listview colors in Gui, Add, ListView, options but those colors cannot be changed while the ListView text is being put on screen.



      If it is not possible to change the Listview line colors as they are being displayed Could I possibly save the contents of the display variable in different colors?



      The variables in the LV_Add statement are NGCSort%x%_11, NGCSort%x%_2, and so on.



      The values in those variable are read in from a text file then displayed on screen as black text.



      Is there a way to save the text file value into the NGCSort%x%_%y% variables in color so that they will display in color rather than trying to change the colors as the line of text is being put on the screen?



      The idea behind this is to give the viewer an idea of how close an astronomical object is to its highest position in the sky. Blue, the object is rising toward its highest point. Red it is near its highest point. Green it is setting down and away from its highest point.



      I am not a professional programmer, just a retired technician trying to work in the old BASIC spaghetti code. Not very pretty but it usually works. :)










      share|improve this question















      I found references to changing text color but not with AutoHotKey. There seems to be a lot of LV modify options but nothing related to display color.



      What I would like to do is to display a line of text in a color to be determined by one of the ListView column variable values as the line of text is put on screen.



      Below is the some of the code. I've shortened the code for clarity but this should demonstrate what I want to do:



      Gui, New ,, Basic List
      Gui, Add, Text, x1, Location %AppLocation% Rec Count %NGCRec%
      Gui, Add, ListView, VFirstGui H350 W256 gNGCSelect1 HScroll, Object Name|etc. etc
      Gui, Add, Text,, Sort Options Siderial Time %SideHr%h etc. etc

      While x < y
      {
      ;If possible change text color here before the next line of text is displayed
      LV_Add(, NGCSort%x%_11, NGCSort%x%_2, NGCSort%x%_5, NGCSort%x%_6, etc. etc)
      x += 1
      }


      Sorry for the double spacing above but other wise all the text wraps together



      I know I can set listview colors in Gui, Add, ListView, options but those colors cannot be changed while the ListView text is being put on screen.



      If it is not possible to change the Listview line colors as they are being displayed Could I possibly save the contents of the display variable in different colors?



      The variables in the LV_Add statement are NGCSort%x%_11, NGCSort%x%_2, and so on.



      The values in those variable are read in from a text file then displayed on screen as black text.



      Is there a way to save the text file value into the NGCSort%x%_%y% variables in color so that they will display in color rather than trying to change the colors as the line of text is being put on the screen?



      The idea behind this is to give the viewer an idea of how close an astronomical object is to its highest position in the sky. Blue, the object is rising toward its highest point. Red it is near its highest point. Green it is setting down and away from its highest point.



      I am not a professional programmer, just a retired technician trying to work in the old BASIC spaghetti code. Not very pretty but it usually works. :)







      autohotkey






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 4:10









      samthecodingman

      1,299913




      1,299913










      asked Nov 20 '18 at 21:48









      Lorence

      614




      614
























          1 Answer
          1






          active

          oldest

          votes


















          0














          From what I understand of your question, you are attempting to shade a part or all of each row based on a value. I do not know how to achieve this, but I can offer an alternate solution.



          AutoHotkey's ListView can display an icon at the start of each line. If you are not currently making use of these icons, you could achieve your purpose by changing the icons based on the value you choose.



          From the AutoHotkey Documentation:



          Link: ListView - ImageList




          An Image-List is a group of identically sized icons stored in memory.
          Upon creation, each ImageList is empty. The script calls IL_Add()
          repeatedly to add icons to the list, and each icon is assigned a
          sequential number starting at 1. This is the number to which the
          script refers to display a particular icon in a row or column header.
          Here is a working example that demonstrates how to put icons into a
          ListView's rows:




          Gui, Add, ListView, h200 w180, Icon & Number|Description  ; Create a ListView.
          ImageListID := IL_Create(10) ; Create an ImageList to hold 10 small icons.
          LV_SetImageList(ImageListID) ; Assign the above ImageList to the current ListView.
          Loop 10 ; Load the ImageList with a series of icons from the DLL.
          IL_Add(ImageListID, "shell32.dll", A_Index)
          Loop 10 ; Add rows to the ListView (for demonstration purposes, one for each icon).
          LV_Add("Icon" . A_Index, A_Index, "n/a")
          LV_ModifyCol("Hdr") ; Auto-adjust the column widths.
          Gui Show
          return

          GuiClose: ; Exit the script when the user closes the ListView's GUI window.
          ExitApp


          Working Example



          I have posted a working example as a Gist here along with some different icon sets.



          Preview of Working Example






          share|improve this answer





















          • A good alternative. I should be able to make a thin icon. This app will normally be used on screens with multiple apps running. Space is at a premium and there is a lot of info to display. Thank you
            – Lorence
            Nov 21 '18 at 19:22










          • If you want to save yourself some work you can cheat by changing the width of the first column using LV_ModifyCol(1, 8) just below the LV_SetImageList call.
            – samthecodingman
            Nov 21 '18 at 19:36











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402079%2fchanging-text-color-in-listview-as-the-line-of-text-is-being-displayed%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          From what I understand of your question, you are attempting to shade a part or all of each row based on a value. I do not know how to achieve this, but I can offer an alternate solution.



          AutoHotkey's ListView can display an icon at the start of each line. If you are not currently making use of these icons, you could achieve your purpose by changing the icons based on the value you choose.



          From the AutoHotkey Documentation:



          Link: ListView - ImageList




          An Image-List is a group of identically sized icons stored in memory.
          Upon creation, each ImageList is empty. The script calls IL_Add()
          repeatedly to add icons to the list, and each icon is assigned a
          sequential number starting at 1. This is the number to which the
          script refers to display a particular icon in a row or column header.
          Here is a working example that demonstrates how to put icons into a
          ListView's rows:




          Gui, Add, ListView, h200 w180, Icon & Number|Description  ; Create a ListView.
          ImageListID := IL_Create(10) ; Create an ImageList to hold 10 small icons.
          LV_SetImageList(ImageListID) ; Assign the above ImageList to the current ListView.
          Loop 10 ; Load the ImageList with a series of icons from the DLL.
          IL_Add(ImageListID, "shell32.dll", A_Index)
          Loop 10 ; Add rows to the ListView (for demonstration purposes, one for each icon).
          LV_Add("Icon" . A_Index, A_Index, "n/a")
          LV_ModifyCol("Hdr") ; Auto-adjust the column widths.
          Gui Show
          return

          GuiClose: ; Exit the script when the user closes the ListView's GUI window.
          ExitApp


          Working Example



          I have posted a working example as a Gist here along with some different icon sets.



          Preview of Working Example






          share|improve this answer





















          • A good alternative. I should be able to make a thin icon. This app will normally be used on screens with multiple apps running. Space is at a premium and there is a lot of info to display. Thank you
            – Lorence
            Nov 21 '18 at 19:22










          • If you want to save yourself some work you can cheat by changing the width of the first column using LV_ModifyCol(1, 8) just below the LV_SetImageList call.
            – samthecodingman
            Nov 21 '18 at 19:36
















          0














          From what I understand of your question, you are attempting to shade a part or all of each row based on a value. I do not know how to achieve this, but I can offer an alternate solution.



          AutoHotkey's ListView can display an icon at the start of each line. If you are not currently making use of these icons, you could achieve your purpose by changing the icons based on the value you choose.



          From the AutoHotkey Documentation:



          Link: ListView - ImageList




          An Image-List is a group of identically sized icons stored in memory.
          Upon creation, each ImageList is empty. The script calls IL_Add()
          repeatedly to add icons to the list, and each icon is assigned a
          sequential number starting at 1. This is the number to which the
          script refers to display a particular icon in a row or column header.
          Here is a working example that demonstrates how to put icons into a
          ListView's rows:




          Gui, Add, ListView, h200 w180, Icon & Number|Description  ; Create a ListView.
          ImageListID := IL_Create(10) ; Create an ImageList to hold 10 small icons.
          LV_SetImageList(ImageListID) ; Assign the above ImageList to the current ListView.
          Loop 10 ; Load the ImageList with a series of icons from the DLL.
          IL_Add(ImageListID, "shell32.dll", A_Index)
          Loop 10 ; Add rows to the ListView (for demonstration purposes, one for each icon).
          LV_Add("Icon" . A_Index, A_Index, "n/a")
          LV_ModifyCol("Hdr") ; Auto-adjust the column widths.
          Gui Show
          return

          GuiClose: ; Exit the script when the user closes the ListView's GUI window.
          ExitApp


          Working Example



          I have posted a working example as a Gist here along with some different icon sets.



          Preview of Working Example






          share|improve this answer





















          • A good alternative. I should be able to make a thin icon. This app will normally be used on screens with multiple apps running. Space is at a premium and there is a lot of info to display. Thank you
            – Lorence
            Nov 21 '18 at 19:22










          • If you want to save yourself some work you can cheat by changing the width of the first column using LV_ModifyCol(1, 8) just below the LV_SetImageList call.
            – samthecodingman
            Nov 21 '18 at 19:36














          0












          0








          0






          From what I understand of your question, you are attempting to shade a part or all of each row based on a value. I do not know how to achieve this, but I can offer an alternate solution.



          AutoHotkey's ListView can display an icon at the start of each line. If you are not currently making use of these icons, you could achieve your purpose by changing the icons based on the value you choose.



          From the AutoHotkey Documentation:



          Link: ListView - ImageList




          An Image-List is a group of identically sized icons stored in memory.
          Upon creation, each ImageList is empty. The script calls IL_Add()
          repeatedly to add icons to the list, and each icon is assigned a
          sequential number starting at 1. This is the number to which the
          script refers to display a particular icon in a row or column header.
          Here is a working example that demonstrates how to put icons into a
          ListView's rows:




          Gui, Add, ListView, h200 w180, Icon & Number|Description  ; Create a ListView.
          ImageListID := IL_Create(10) ; Create an ImageList to hold 10 small icons.
          LV_SetImageList(ImageListID) ; Assign the above ImageList to the current ListView.
          Loop 10 ; Load the ImageList with a series of icons from the DLL.
          IL_Add(ImageListID, "shell32.dll", A_Index)
          Loop 10 ; Add rows to the ListView (for demonstration purposes, one for each icon).
          LV_Add("Icon" . A_Index, A_Index, "n/a")
          LV_ModifyCol("Hdr") ; Auto-adjust the column widths.
          Gui Show
          return

          GuiClose: ; Exit the script when the user closes the ListView's GUI window.
          ExitApp


          Working Example



          I have posted a working example as a Gist here along with some different icon sets.



          Preview of Working Example






          share|improve this answer












          From what I understand of your question, you are attempting to shade a part or all of each row based on a value. I do not know how to achieve this, but I can offer an alternate solution.



          AutoHotkey's ListView can display an icon at the start of each line. If you are not currently making use of these icons, you could achieve your purpose by changing the icons based on the value you choose.



          From the AutoHotkey Documentation:



          Link: ListView - ImageList




          An Image-List is a group of identically sized icons stored in memory.
          Upon creation, each ImageList is empty. The script calls IL_Add()
          repeatedly to add icons to the list, and each icon is assigned a
          sequential number starting at 1. This is the number to which the
          script refers to display a particular icon in a row or column header.
          Here is a working example that demonstrates how to put icons into a
          ListView's rows:




          Gui, Add, ListView, h200 w180, Icon & Number|Description  ; Create a ListView.
          ImageListID := IL_Create(10) ; Create an ImageList to hold 10 small icons.
          LV_SetImageList(ImageListID) ; Assign the above ImageList to the current ListView.
          Loop 10 ; Load the ImageList with a series of icons from the DLL.
          IL_Add(ImageListID, "shell32.dll", A_Index)
          Loop 10 ; Add rows to the ListView (for demonstration purposes, one for each icon).
          LV_Add("Icon" . A_Index, A_Index, "n/a")
          LV_ModifyCol("Hdr") ; Auto-adjust the column widths.
          Gui Show
          return

          GuiClose: ; Exit the script when the user closes the ListView's GUI window.
          ExitApp


          Working Example



          I have posted a working example as a Gist here along with some different icon sets.



          Preview of Working Example







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 1:25









          samthecodingman

          1,299913




          1,299913












          • A good alternative. I should be able to make a thin icon. This app will normally be used on screens with multiple apps running. Space is at a premium and there is a lot of info to display. Thank you
            – Lorence
            Nov 21 '18 at 19:22










          • If you want to save yourself some work you can cheat by changing the width of the first column using LV_ModifyCol(1, 8) just below the LV_SetImageList call.
            – samthecodingman
            Nov 21 '18 at 19:36


















          • A good alternative. I should be able to make a thin icon. This app will normally be used on screens with multiple apps running. Space is at a premium and there is a lot of info to display. Thank you
            – Lorence
            Nov 21 '18 at 19:22










          • If you want to save yourself some work you can cheat by changing the width of the first column using LV_ModifyCol(1, 8) just below the LV_SetImageList call.
            – samthecodingman
            Nov 21 '18 at 19:36
















          A good alternative. I should be able to make a thin icon. This app will normally be used on screens with multiple apps running. Space is at a premium and there is a lot of info to display. Thank you
          – Lorence
          Nov 21 '18 at 19:22




          A good alternative. I should be able to make a thin icon. This app will normally be used on screens with multiple apps running. Space is at a premium and there is a lot of info to display. Thank you
          – Lorence
          Nov 21 '18 at 19:22












          If you want to save yourself some work you can cheat by changing the width of the first column using LV_ModifyCol(1, 8) just below the LV_SetImageList call.
          – samthecodingman
          Nov 21 '18 at 19:36




          If you want to save yourself some work you can cheat by changing the width of the first column using LV_ModifyCol(1, 8) just below the LV_SetImageList call.
          – samthecodingman
          Nov 21 '18 at 19:36


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402079%2fchanging-text-color-in-listview-as-the-line-of-text-is-being-displayed%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Create new schema in PostgreSQL using DBeaver

          Deepest pit of an array with Javascript: test on Codility

          Costa Masnaga