Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Setting custom colors for items in the tree

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting custom colors for items in the tree

    I think I should ask the v12 guys for help :)

    How do you set custom colors for items in the tree in the "Learning Xdialog" example given for 'Select a customer -Populate dynamically from a table'

    It is located under "Whats's new in V8" -> "Tree Controle'.

    I have already tried using the method given in "Learning XDialog" for setting "custom colors for items in the tree," but it doesn't work.

    Any help is greatly appreciated.

    Ninus​

  • #2
    Ninus,
    It is not clear to what you want custom colors assigned. You will also need to determine what color will be assigned to what condition. It is also helpful if you post the code that you created that "doesn't work".
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    Comment


    • #3
      Hello Mike and thank you for reply,

      The code at question is the example given at 'learning xdialog'->What's New in V8->Select a customer-Populate dynamically from a table.

      The example given woks fine but with no custom colors. We do get the following resault:

      +(bill_state_region)
      +(State)
      +(bill_city)

      Now, we just want each level to show in different colors. Lets say (bill_state_region) to show in blue, (State) to show in red and (bill_city) in dark green.

      So we need to add {S=<number>} Directive to the code which I have done here.


      'Date Created: 28-Jun-2006 09:07:04 AM
      'Last Updated: 18-Jan-2023 11:34:06 PM
      'Created By : Selwyn
      'Updated By : Ninus

      dim treecolors as c = <<%str%
      Blue
      Red
      Dark Green
      %str%


      dim filterExpn as c
      dim orderExpn as c
      dim contentExpn as c
      dim tablename as c

      tablename = "customer"
      contentExpn = "'{S=1}'+alltrim(bill_state_region)+'|{EXPAND=Expanding tree...}!expandState('+quote('{S=1}'+alltrim(bill_state_region))+')'"
      filterExpn = "bill_state_region<> '' .and.unique_key_value()"
      orderExpn = "bill_state_region"

      dim treeList as c
      treeList = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)
      dim selected as c = ""

      'The enable expression for the OK button looks to see if the 'selected' variable starts with 'ID:'
      'If so, then we know we are at an endpoint in the tree.

      dim flagOK as l = .f.

      ui_dlg_box("Select Customer",<<%dlg%
      [%X;S=BLR;D="|";[email protected]%.50,20selected^<treelist];
      [.50selected];
      {justify=right}
      <10&OK!ok?left(selected,3)="ID:"> <Cancel>;
      %dlg%,<<%code%
      if a_dlg_button ="ok" then
      flagOK = .t.
      end if
      %code%)


      if flagOK = .t. then
      ui_msg_box("","You selected customer number: " + substr(selected,4))

      end if


      function expandState as c (state as c )
      ui_yield()
      dim filterExpn as c
      dim orderExpn as c
      dim contentExpn as c
      dim tablename as c
      tablename = "customer"
      contentExpn = "'{S=2}'+alltrim(bill_city)+'|{EXPAND=Expanding tree...}!expandCity('+quote('{S=2}'+alltrim(bill_city))+')'"
      filterExpn = "unique_key_value() .and. '{S=1}'+bill_state_region=" + quote(state)
      orderExpn = "bill_city"

      expandState = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)

      if expandState = "" then
      expandState = "<None>"
      end if

      end function



      function expandCity as c (city as c )
      ui_yield()

      dim filterExpn as c
      dim orderExpn as c
      dim contentExpn as c
      dim tablename as c
      tablename = "customer"
      contentExpn = "'{DATA=ID:'+customer_id+'}'+'{S=3}'+alltrim(lastname)+', ' + alltrim(firstname)"
      filterExpn = "unique_key_value() .and. '{S=2}'+bill_city=" + quote(city)
      orderExpn = "lastname"

      expandCity = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)

      if expandCity = "" then
      expandCity = "<None>"
      end if

      end function




      If you try the code you'll see the resault show the colors changing for each level, but the tree itself is not functioning as it should.

      I know that there are other ways to create a tree list but my question is specifically about the above example and method.

      Why tree list does not display correctly when the {S=<number>} Directive is used in the code? .. Is this a bug?​

      Comment


      • #4
        I understand what you are trying to do. But I can't find any documentation for the process you are trying to use.
        Unless I'm missing something, "Whats's new in V8" -> "Tree Controle'. example you are referencing has no colors.

        What are you using as a reference to try and add colors?
        Alpha 5 Version 11
        AA Build 2999, Build 4269, Current Build
        DBF's and MySql
        Desktop, Web on the Desktop and WEB

        Ron Anusiewicz

        Comment


        • #5
          Hi Ronald,

          "Whats new in V8..." is the path to the above code in 'Learning_Xdialog' (without the {S=<number>} directive that I've added)

          'Learning_Xdialog' is a list of free tutorials available in Alpha Anywhere that you can install. (start Alpha Anywhere and select "Sample and Tutorial Workspaces...")

          In the tutorial's example, you can dynamically populate a record using a table. However, when you attempt to apply colors for "level clarity," tree control does not display as intended.

          I frequently utilise the technique shown in that example throughout my applications, however I've just realised that it is ineffective if I need to add colors for clarity.​

          Comment


          • #6
            I don't understand this statement:
            So we need to add {S=<number>} Directive to the code which I have done here.
            Where do I find any supporting documentation for:
            {S=<number>}
            I don't know what this means nor do I understand what the command is suppose to do.
            I looked in all of my documentation and I can not find any reference to :
            {S=<number>}
            Please tell me where I can learn about : {S=<number>}
            Alpha 5 Version 11
            AA Build 2999, Build 4269, Current Build
            DBF's and MySql
            Desktop, Web on the Desktop and WEB

            Ron Anusiewicz

            Comment


            • #7
              Ronald,

              I know alpha's documentation is all over the place and not easy to retrieve information.

              Here you can read about {S=<number>}:

              Alpha Anywhere | Xdialog Tree Control Custom Colors for Tree Items (alphasoftware.com)

              Comment


              • #8
                Hi Ron,

                It is the redundant subject and already completely discussed at version 11.

                https://forum.alphasoftware.com/foru...ms-in-the-tree

                Comment


                • #9
                  Ninus,

                  Thanks for the link to the help file. I had no idea that this could be done.
                  That said, this on the surface looks to be a little involved and I do not have the time to dive into this now.
                  Off the top of my head, you are building the code on the fly.
                  The first thing I would do is to strip out all reference to color and verify that your code method is working.
                  Once you get the code and functions working correctly, you can then start piecing in color to the different
                  levels one at a time.

                  Let us know how you make out please. When I get some time I will take a look.
                  Alpha 5 Version 11
                  AA Build 2999, Build 4269, Current Build
                  DBF's and MySql
                  Desktop, Web on the Desktop and WEB

                  Ron Anusiewicz

                  Comment


                  • #10
                    Ninus, Run this in AlphaSports. Using the Customer table to get data.

                    Code:
                    'Date Created: 28-Jun-2006 09:07:04 AM
                    'Last Updated: 24-Jan-2023 09:02:01 PM
                    'Created By : Selwyn
                    'Updated By  : Ron
                    
                    dim treecolors as c = <<%str%
                    Blue
                    Red
                    Dark Green
                    %str%
                    
                    dim filterExpn as c
                    dim orderExpn as c
                    dim contentExpn as c
                    dim tablename as c
                    
                    tablename = "customer"
                    contentExpn = "'{S=1}'+alltrim(bill_state_region)+'.{S=2}'+alltrim(bill_city)+'.{S=3}'+alltrim(Lastname)"
                    filterExpn = "bill_state_region<> '' "
                    orderExpn = "bill_state_region + bill_city + Lastname"
                    
                    dim tree as c
                    tree = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)
                    dim selected as c = ""
                    
                    dim pHeading as p
                    pHeading.BodyText = "This example shows how you can define custom foreground and background colors for each item in a tree control. A CR-LF delimited list of colors is passed into the tree control."
                    pHeading.HeadingText = "Tree Control with Colored Items"
                    pHeading.Image = "$$large.code.aScript"
                    
                    ui_dlg_box("Tree Control - Custom Colors",<<%dlg%
                    {units=F}{font=Calibri,12}{xmargin=4,4}{ysize=.3}
                    {XdialogTitleSection=40,5pHeading};
                    {lf};
                    [%X;S=BLR;D=".";[email protected]%.30,25item^<tree]
                    %dlg%)​
                    Last edited by Ronald Anusiewicz; 01-24-2023, 10:18 PM.
                    Alpha 5 Version 11
                    AA Build 2999, Build 4269, Current Build
                    DBF's and MySql
                    Desktop, Web on the Desktop and WEB

                    Ron Anusiewicz

                    Comment


                    • #11
                      Hello and thanks for your post, Ronald.

                      I'm happy that you are now aware of another one of AA's hidden secret treasures (when it works, of course).

                      Don't you agree that having different colours on the branches of a "tree list" adds so much more clarity?

                      Having said that, it is not a good idea to code everything in one "contentExpn," "filterExpn," "orderExp" and apply it for all branches (maybe we'll discover that it is the only way...I hope not).

                      Let me use an illustration:

                      Imagine that we have a table of "Items" that has several "categories," each of which has "sub-categories," each of which has "sub-sub-categories," and so on.

                      We want to display a tree list with all of its branches, but we also want to apply different filters to each branch and perhaps use a different colour (such as grey) for a certain item that is not available (not in stock). It is now obvious how complicated "contentExpn," "filterExpn," and "orderExp" can be.

                      Here, having separate branches that are filtered and sorted helps to save alot of time and avoid mistakes, AA does support the use of "ParentNode |! function" in a tree control for this purpose. However, tree displays incorrectly when it is used with a function that has the {S=<number>} directive applied.

                      I think Alpha Team is aware of this issue, and if they are, I would like them to confirm it.​

                      Comment


                      • #12
                        I think Alpha Team is aware of this issue, and if they are, I would like them to confirm it.​
                        Well, the simple answer is: From the control panel, Help, Send a Bug Report.
                        Attach a working example that demonstrates the error. Selwyn usually answer sometimes within an hour.
                        Alpha 5 Version 11
                        AA Build 2999, Build 4269, Current Build
                        DBF's and MySql
                        Desktop, Web on the Desktop and WEB

                        Ron Anusiewicz

                        Comment

                        Working...
                        X