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 do I place a Dynamic image in an xDialog list

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

    How do I place a Dynamic image in an xDialog list

    I'm working with a list in an xDialog.

    I want to display one of 2 images in a list. I have a logical field that is either true or false.

    If the field is false, I would like to have the image: Image_Not_Posted = "{I:'A5_ball_white'}".
    If the field is true, I would like to have the image: Image_Posted = "{I:'A5_ball_green'}".

    The list is built from the following code:

    Code:
    auto_list_vcCA = table.external_record_content_get("wodesclabor_m_ca",\
    " 'Item: ' + Itemno + ' ' + if(Posted=.F.,' ','*') + left(Descrep,100) + space(60) + '&' + transno + swkno + '&&' ",\
    "padl(alltrim(Itemno),4,\"0\")",\
    "Transno="+s_quote(vcHeadTransno))
    The controlling field is: if(Posted=.F.,' ','*')

    I want something that would give me this: if(Posted=.F.,image_not_posted,image_posted)

    the code for the list is:

    Code:
    {region}
    {font=calibri,11}
    Corrective Actions - Double Click on Item to Edit, an * Denotes Entries Posted to the Work Order:;
    {font=fixdsys regular,10}
    [.110,10vcCA^#auto_list_vcCA!Edit_*];
    {endregion};;
    I've been looking at the Help and either I can do this and I'm just not understanding the help examples or I can't do what I want.

    Thanks,
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    #2
    Re: How do I place a Dynamic image in an xDialog list

    Hi Ron,
    Have you considered creating the xdialog from a browse? If you add buttons or images into the browse column, the XML will convert it.

    In this example the button image changes (and corresponding action) based on whether a field is blank or not.

    brwsrch.jpg
    Last edited by MoGrace; 11-05-2016, 11:18 AM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #3
      Re: How do I place a Dynamic image in an xDialog list

      Ron,
      Get the data, loop through and identify what image is needed, and build the list string. I attached an example. Hope it helps.

      Code:
      dim postlist[100] as C
      dim vwhich_img as C
      dim list as C=""
      dim filelist[100] as C
      data = <<%a%
      value1^^f
      value2^^t
      value3^^f
      %a%
      
      for each foo in data
      	if word(foo,2,"^^")="f"
      		vwhich_img=".1"
      	else
      		vwhich_img=".2"
      	end if
      	list=list+word(foo,1,"^^")+vwhich_img+crlf()
      next
      
      postlist.initialize(list)
      postlist.sort()
      result = ui_dlg_box("Select Table/Set",<<%dlg%
      {region}
      [%I=A5_ball_white,A5_ball_green;O={I=@$(.)+1} {@1,$(.)-1}%.25,10posted^#postlist!evk_*]
      {endregion};
      <10OK> <10Cancel>
      %dlg%,<<%code%
      if left(a_dlg_button,4)="evk_"
      	if a_dlg_button="evk_change"
      		msgbox(posted)
      	end if
      a_dlg_button=""
      end if
      %code%)
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


        #4
        Re: How do I place a Dynamic image in an xDialog list

        Ron

        I have this for your question,
        I want something that would give me this: if(Posted=.F.,image_not_posted,image_posted)
        Code:
        'set the image before get the list.
        image1 = "{I:'$$generic.checked.on'}"
        image2 = "{I:'$$generic.checked.off'}"
        vTempList = table.external_record_content_get("mytable",\
        "Myfield1+'{T=3.0}'+"\
        "If(limited=.t.,"+quote(var->image1)+","+quote(var->image2)+")+'{T=3.5}'+"\
        "If(IsDrop=.t.,"+quote(var->image1)+","+quote(var->image2)+")"," ",query.filter)
        The key is, apply this "+quote(var->image1)+"
        It is simple but I spent a lots time to figure it out. I used the O={@@} owner_draw directive on my listbox and have not try the other directive yet.

        Comment


          #5
          Re: How do I place a Dynamic image in an xDialog list

          Thank you all very much.

          Robin, your example is a beautiful piece of work.

          In my situation, I have 3 lists on a single xDialog with each list filtered on the first list. I have never done what you suggested and I didn't want to go that route at this time.

          Mike, great suggestion and thanks so much for you help. I was able to get your code to work but I was running into an odd situation where if my text had a period in it, the description of work would be truncated.

          While trying to resolve that problem, John came up with his suggestion. His was the easiest to implement and it works perfectly.

          Code:
          {region}
          {font=calibri,11}
          Corrective Actions - Double Click on Item to Edit, an * Denotes Entries Posted to the Work Order:;
          {font=fixdsys regular,10}
          [%O={@@}%.110,10vcCA^#auto_list_vcCA!Edit_*]
          {endregion};;
          
          ELSEif a_dlg_button = "newhead" THEN
          	vcHeadTransno=extract_string(vcHead,"$","$$")
          	auto_list_vcSwk = table.external_record_content_get("wosquawk",\
          	"\"Item: \"+Itemno+\" \"+left(Descrep,100)+space(60)+\"&\"+swkno+\"&&\"","padl(alltrim(Itemno),4,\"0\")",\
          	"Transno="+s_quote(vcHeadTransno))
          	vcSwkNo=extract_string(vcSwk,"&","&&")
          	auto_list_vcCA=CA_List(vcHeadTransno)
          	a_dlg_button = ""
          
          
          
          FUNCTION CA_List as C ( vTrans as C )
          	image1 = "{I:'A5_ball_green'}"
          	image2 = "{I:'A5_ball_white'}"
          	
          	auto_list_vcCA = table.external_record_content_get("wodesclabor_m_ca",\
          	"If(Posted=.t.,"+quote(var->image1)+","+quote(var->image2)+")+'  Item: ' + Itemno + ' ' + left(Descrep,100) + space(60) + '&' + transno + swkno + '&&' ",\
          	"padl(alltrim(Itemno),4,\"0\")",\
          	"Transno="+s_quote(vTrans))
          	
          	ca_list=auto_list_vcCA
          END FUNCTION
          This code is used in a number of places, so I made it into a function to simplify my code.

          Thanks again everyone.
          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


            #6
            Re: How do I place a Dynamic image in an xDialog list

            Share something in this A5 community

            Comment

            Working...
            X