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

How would I change font color in Xdialog

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

    How would I change font color in Xdialog

    I am new to Xdialog... so far I am really liking what you can do with it. However I have run into a problem that I can't seem to find the answer to and am hoping someone can help me..

    I am making a helpdesk program for our company that is a specific color scheme. The users want the dialog box formatting to be consistent with the forms throughout the application.

    I have an XDialog text box (Ok only) that evaluates an expression and displays it. I found what to do to change the background color for the entire box, but need to change the font color for the entire box. What statement do I need to add to my Xdialog box to do this?

    Thanks very much for any assistance!

    JoAnn
    Land of the Free, Because of the Brave
    Support our US Military

    #2
    RE: How would I change font color in Xdialog

    Ordinarily, you can't. The font command allows no color option:

    {font=fontname, fontsize, style}


    However, having said that, you can control font colors using Owner-Draw Commands. here is a snippet:

    vText1 = "Your Comment Here"

    [b]
    ui_modeless_dlg_box("Testing...",
    {'%O={F=Arial,12,B}{C=Blue}{I:'$a5_x_executed'} Test%};
    vText1
    {'%O={F=Arial,10,B}{C=Dark Red} This will only take a moment.%};
    %dlg%,
    1=1
    %code%)
    xbasic_wait_for_idle()
    sleep(5)
    ui_modeless_dlg_close("Testing...")
    end
    ui_modeless_dlg_box("test",
    this is alpha
    %dlg%,
    1=1
    %code%)
    Peter
    AlphaBase Solutions, LLC

    [email protected]
    https://www.alphabasesolutions.com


    Comment


      #3
      RE: How would I change font color in Xdialog

      JoAnn,

      If I understand your needs correctly, check out the XDialog tutorials under miscellanious examples in the .chm help file and look at "Colored Static Text" and "Colored Dynamic Text"

      Hope this helps some ...

      Scott

      Comment


        #4
        RE: How would I change font color in Xdialog

        Peter, Thanks for the code snippet. I did a little testing but couldn't get it to work with my code... but I will keep trying. Below is the XDialog code I'm trying to change the font color on; in case anyone has ideas how I can make this work:

        DIM form_name as C
        if is_object(topparent.this) then
        form_name = topparent.name()+".this"
        else
        form_name = ""
        end if
        DIM vTestDialog as C
        DIM SHARED varC_result as C
        DELETE expression_result
        expression_result = eval("\"Hello, your user name is: \"+user_name()+\". You are a member of \"+upper(user_groups())+\" group and your real name is \"+lookupc(\"F\",user_name(),\"Userfull\",\"users\",\"Usr\") ",form_name)
        vTestDialog = convert_type(expression_result,"C")
        heading_string = " Test XDialog Box "
        ok_button_label = "&OK"
        cancel_button_label = "&Cancel"
        varC_result = ui_dlg_box("Who Am I",""%dlg%
        {background=Pale Blue}
        {region}
        {text=30,1:heading_string}
        {endregion};
        {line=1,0};
        {region}
        {image=objects}{sp} |{text=40,4:vTestDialog};
        {endregion};
        {line=1,0};
        {region}
        "*10=ok_button_label!OK"
        {endregion};
        %dlg%)

        Scott, I am searching through all the tutorials and Xbasic reference manuals hoping to find something. No luck yet. Thanks y'all.
        Land of the Free, Because of the Brave
        Support our US Military

        Comment


          #5
          RE: How would I change font color in Xdialog

          JoAnn,

          Try this:

          DIM form_name as C
          if is_object(topparent.this) then
          form_name = topparent.name()+".this"
          else
          form_name = ""
          end if
          DIM vTestDialog as C
          DIM SHARED varC_result as C
          DELETE expression_result
          expression_result = eval("\"Hello, your user name is: \"+user_name()+\". You are a member of \"+upper(user_groups())+\" group and your real name is \"+lookupc(\"F\",user_name(),\"Userfull\",\"users\",\"Usr\") ",form_name)
          vTestDialog = convert_type(expression_result,"C")
          font_color = "Dark Blue"
          background_color = "Pale Blue"
          formatted_text = "{B="+background_color+"}" + "{C="+font_color+"}" + vTestDialog
          heading_string = " Test XDialog Box "
          ok_button_label = "&OK"
          cancel_button_label = "&Cancel"
          varC_result = ui_dlg_box("Who Am I",""%dlg%
          {background=Pale Blue}
          {region}
          {text=30,1:heading_string}
          {endregion};
          {line=1,0};
          {region}
          {image=objects}{sp} |{text=40,4:formatted_text};
          {endregion};
          {line=1,0};
          {region}
          "*10=ok_button_label!OK"
          {endregion};
          %dlg%)

          I couldn't test it and you might need to change the colors, but I think it will give you what you need.

          Scott

          Comment


            #6
            RE: How would I change font color in Xdialog

            Scott

            Unfortunately, owner draw controls turn off wrapped text, so that method fails. However, it is possible if complicated. The trick is to wrap the text, then break down it down into single lines. Apply the formating to each line, modify the xdialog to show each line and it does work. Here is JoAnns code modified.


            DIM form_name as C
            if is_object(topparent.this) then
            form_name = topparent.name()+".this"
            else
            form_name = ""
            end if
            DIM vTestDialog as C
            DIM SHARED varC_result as C
            DELETE expression_result
            expression_result = eval("\"Hello, your user name is: \"+user_name()+\". You are a member of \"+upper(user_groups())+\" group and your real name is \"+lookupc(\"F\",user_name(),\"Userfull\",\"users\",\"Usr\") ",form_name)

            vTestDialog = convert_type(expression_result,"C")

            wrapped = word_wrap(vTestDialog,35)
            lines = line_count(wrapped)
            dim textlines[lines] as c
            textlines.initialize(wrapped)
            insert_str = ""
            for i = 1 to lines
            eval("line"+alltrim(str(i))) = "{B=Pale blue}{C=Red}" + textlines[i]
            insert_str = insert_str + "{sp=3}{text=%O={@@}%40,1:line" + alltrim(str(i))+"};" + crlf()
            next

            heading_string = " Test XDialog Box "
            ok_button_label = "&OK"
            cancel_button_label = "&Cancel"

            dlg_code = ""%dlg%
            {background=Pale Blue}
            {region}
            {text=30,1:heading_string}
            {endregion};
            {line=1,0};
            {region}
            {image=objects}|{region}; __Insert_str__{endregion}
            {endregion};
            {line=1,0};
            {region}
            "*10=ok_button_label!OK"
            {endregion};
            %dlg%

            dlg_code = stritran(dlg_code,"__Insert_str__",insert_str)

            varC_result = ui_dlg_box("Who Am I",dlg_code)

            I tested this with some dummy data and it did work. It might take some tweaking with the wrap to make it fit correctly.

            Jerry

            Comment


              #7
              RE: How would I change font color in Xdialog

              Thanks Scott for the test code. I tried it but got the same results as I was getting; pale blue background with black text and then the line {B=Pale Blue}{C=Dark Blue}.

              Jerry, thank you also! I tried your code but got an error message that says
              wrapped = word_wrap(vTestDialog,35) function not recognized
              Do I need to define it?

              I will keep fiddling with it though and see if I can come up with something.
              Land of the Free, Because of the Brave
              Support our US Military

              Comment


                #8
                RE: How would I change font color in Xdialog

                JoAnn

                Word_wrap() is a valid function in the current build of A5V5. What build are you using? I did try my solution with some long test text replacing "expression_result" and it did work correctly. The code attached works in my version. Just paste it in a script and run it.

                Jerry

                Comment


                  #9
                  RE: How would I change font color in Xdialog

                  Thanks Jerry for helping me with this. Ok, we're getting warmer!!

                  On my regular PC I am using build 14981051. I just set up a test PC and loaded it with the latest A5 patch. The script you created works, until I remark out your eval expression line and un-remark out mine. Then I get an error about the array index out of bounds. attached is a jpg showing the error message. Thanks again for all your help!
                  Land of the Free, Because of the Brave
                  Support our US Military

                  Comment


                    #10
                    RE: How would I change font color in Xdialog

                    JoAnn

                    Two possibilities. Either your eval expression does not return any text, which is unlikely, or the line count expression gives the wrong number of lines. A good check would be to put a couple message boxes before the code that opens the xdialog and test the values for vTestDialog and wrapped.

                    vTestDialog = convert_type(expression_result,"C")
                    ui_msg_box("",vTestDialog)

                    wrapped = word_wrap(vTestDialog,35)
                    ui_msg_box("",wrapped)

                    you could also see what the line count is before the array is created.

                    lines = line_count(wrapped)
                    ui_msg_box("","lines = "+alltrim(str(lines)))

                    if the line_count is actually greater than the number of lines in wrapped, which I suspect is happening, then try this

                    wrapped = word_wrap(vTestDialog,35)
                    wrapped = rtrim(wrapped)

                    That will remove any trailing crlf() and should make line_count correct.

                    Jerry

                    Comment

                    Working...
                    X