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

Help to Place LAST selection at END of List

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

    Help to Place LAST selection at END of List

    Hello,
    I've had a heck of a time trying to add selections to the END of a list. It works great EXCEPT when I click on "Sacrum", "Extremity". OR "Pelvis"... when I click more than one of those it moves the other to the beginning of the list and I want to keep it at the end. Any help here would be appreciated! Here's the xdialog:


    'begin code

    dim a_vSpinList as C
    dim vSpinList1 as c
    dim vSpinList as c
    a_vSpinList = <<%str%
    c1
    c2
    c3
    c4
    c5
    c6
    c7
    t1
    t2
    t3
    t4
    t5
    t6
    t7
    t8
    t9
    t10
    t11
    t12
    l1
    l2
    l3
    l4
    l5
    Extremity
    Sacrum
    Pelvis
    %str%



    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"

    varC_result = ui_dlg_box("Dysfunction",<<%dlg%
    {Windowstyle=Gradient Horizontal}

    {region}{font=Arial,13,b}
    {sp=1}[%m;h;O={@@};C=14%.112,6vSpinList^#a_vSpinList]{watch=vSpinList!fooSpinList}
    {endregion};

    {region}
    {color=Red on #254+254+235}{font=Tahoma,9}{sp=1}[%MW%.112,4vSpinDys2]{watch=vSpinDys2!fooSpinDysList}
    {endregion};

    {Region}{justify=center}{color=""}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion}
    %dlg%,<<%code%


    if a_dlg_button = "fooSpinList" then
    a_dlg_button = ""
    if vSpinList > "" then
    vOldSpinList = VSpinlist1+vSPinList
    vSpinListLast = word_unique(vOldSpinList, crlf() )
    vSpinList1 = VSpinlist1+vSPinListLast
    vNewSpinList = *remove_duplicatesi(vSpinList1)
    'vSpinList1 = word_unique(VSpinlist1, crlf() )
    vSpinList1 = *reverse_words(vNewSpinList, crlf())
    a_dlg_button = ""
    vSpinList2= case(line_count(vSpinList1)=1,crlf_to_comma(vSpinList1),line_count(vSpinList1)=2,strtran(crlf_to_comma(vSpinList1),","," and "),line_count(vSpinList1)>2,strtran(crlf_to_comma(*reverse_words("and "+*reverse_words(vSpinList1))),",",", "),.t.,"")
    vSpinList2 = f_upper(vSpinList2)
    vSpinDys2 = vSpinList2
    vSpinList1 = ""
    else
    vSpinDys2 = ""
    end if
    end if


    %code%)

    '---end code

    #2
    Re: Help to Place LAST selection at END of List

    Maybe not the best way... but it works.

    '--------
    if a_dlg_button = "fooSpinList" then
    dim removelist as c
    a_dlg_button = ""
    if vSpinList > "" then
    vSpinList1 = VSpinlist1+vSpinList
    vSpinList1 = word_unique(VSpinlist1, crlf() )

    for each foo in vSpinList1
    dim spinexists as n = word_occurs(vSPinList, foo.value)
    if spinexists = 0
    removelist = foo ' word_subtract(vSpinList1, foo.value, crlf())
    end if
    next
    vSpinList1 = word_subtract(vSpinList1, removelist, crlf())

    a_dlg_button = ""
    vSpinList2= if(w_count(crlf_to_comma(vSpinList1),",")>1,strtran(stuff(crlf_to_comma(vSpinList1),at(",",crlf_to_comma(vSpinList1),-1),1," and "),",",", "),crlf_to_comma(vSpinList1))
    vSpinList2 = f_upper(vSpinList2)
    vSpinDys2 = vSpinList2

    else
    vSpinDys2 = ""
    end if
    end if

    Comment


      #3
      Re: Help to Place LAST selection at END of List

      Do you, by design, want the selection (all the selections, i.e. all items selected) to be highlighted? All at the same time? or only when selected?

      Do you want the list in the end to be sorted alphabetically? or according to when items were selected?

      Comment


        #4
        Re: Help to Place LAST selection at END of List

        Gabe,

        I Needed all to be highlighted and stay highlighted so user could easily see what was selected.

        I needed the last selected item to show up at the end of the list.

        Don

        Comment


          #5
          Re: Help to Place LAST selection at END of List

          Easy as pie.
          Sorry, I replaced your variables' names with shorter names. I am allergic to long names, they confuse me!
          Code:
          dim lst as C
          dim show as c
          dim slst as c
          lst= <<%str%
          c1
          c2
          c3
          c4
          c5
          c6
          c7
          t1
          t2
          t3
          t4
          t5
          t6
          t7
          t8
          t9
          t10
          t11
          t12
          l1
          l2
          l3
          l4
          l5
          Extremity
          Sacrum
          Pelvis
          %str%
          varC_result = ui_dlg_box("Dysfunction",<<%dlg%
          {Windowstyle=Gradient Horizontal}
          {region}{font=Arial,13,b}
          {sp=1}[%m;h;O={@@};C=14%.112,6sLst^#lst!ls_*]
          {endregion};
          {region}
          {color=Red on #254+254+235}{font=Tahoma,9}{sp=1}[%MW%.112,4show]
          {endregion};
          {Region}{justify=center}{color=""}
          <*15OK!OK> <15Cancel!CANCEL>
          {endregion}
          %dlg%,<<%code%
          if a_dlg_button="ls_change"
          a_dlg_button=""
          show=slst
          show=crlf_to_comma(slst)
          show=*reverse_words(show,",")
          show=strtran(show,","," and ",occurs(",",show))
          end if
          %code%)

          Comment


            #6
            Re: Help to Place LAST selection at END of List

            Gabe,
            The code you provided gives the same result I was trying to avoid with my first code. When I select multiple choices.... then also select pelvis and sacrum it moves pelvis to the start of the list and not at the end of the list (which is where I want it). Here's the refined code (without the fancy variable names) that works for me:


            'begin code

            dim a_List as C
            dim List1 as c
            dim vList as c
            a_List = <<%str%
            c1
            c2
            c3
            c4
            c5
            c6
            c7
            t1
            t2
            t3
            t4
            t5
            t6
            t7
            t8
            t9
            t10
            t11
            t12
            l1
            l2
            l3
            l4
            l5
            Extremity
            Sacrum
            Pelvis
            %str%



            ok_button_label = "&OK"
            cancel_button_label = "&Cancel"

            varC_result = ui_dlg_box("Dysfunction",<<%dlg%
            {Windowstyle=Gradient Horizontal}

            {region}{font=Arial,13,b}
            {sp=1}[%m;h;O={@@};C=14%.112,6vList^#a_List]{watch=vList!fooList}
            {endregion};

            {region}
            {color=Red on #254+254+235}{font=Tahoma,9}{sp=1}[%MW%.112,4vFinalList]{watch=vFinalList!fooDysList}
            {endregion};

            {Region}{justify=center}{color=""}
            <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
            {endregion}
            %dlg%,<<%code%

            if a_dlg_button = "fooList" then
            dim removelist as c
            a_dlg_button = ""
            if vList > "" then
            List1 = List1+vList
            List1 = word_unique(List1, crlf() )

            for each foo in List1
            dim name_exists as n = word_occurs(vList, foo.value)
            if name_exists = 0
            removelist = foo ' word_subtract(List1, foo.value, crlf())
            end if
            next
            List1 = word_subtract(List1, removelist, crlf())

            a_dlg_button = ""
            vList2= if(w_count(crlf_to_comma(List1),",")>1,strtran(stuff(crlf_to_comma(List1),at(",",crlf_to_comma(List1),-1),1," and "),",",", "),crlf_to_comma(List1))
            vList2 = f_upper(vList2)
            vFinalList = vList2

            else
            vFinalList = ""
            end if
            end if


            %code%)

            '---end code

            Comment


              #7
              Re: Help to Place LAST selection at END of List

              Don:
              Your code works only when you select but try to un-select, it doesn't work.

              Here is a simple one that works both ways:
              Code:
              dim lst as C
              dim show as c
              dim slst as c
              dim prv_lst as c
              lst="c1,c2,c3,c4,c5,c6,c7,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,l1,l2,l3,l4,l5,Extremity,Sacrum,Pelvis"
              lst=comma_to_crlf(lst)
              varC_result = ui_dlg_box("Dysfunction",<<%dlg%
              {Windowstyle=Gradient Horizontal}
              {region}{font=Arial,13,b}
              {sp=1}[%m;h;O={@@};C=14%.112,6sLst^#lst!ls_*]
              {endregion};
              {region}
              {color=Red on #254+254+235}{font=Tahoma,9}{sp=1}[%MW%.112,4show]
              {endregion};
              {Region}{justify=center}{color=""}
              <*15OK!OK> <15Cancel!CANCEL>
              {endregion}
              %dlg%,<<%code%
              if a_dlg_button="ls_change"
              a_dlg_button=""
              if slst>show
              show=crlf_to_comma(slst)
              show=words(show,2,50,.t.,",")+if(w_count(show,",")<2,""," and ")+word(show,1,",")
              else
              show=crlf_to_comma(slst)
              show=strtran(show,","," and ",occurs(",",show))
              end if
              end if
              %code%)
              Last edited by G Gabriel; 08-13-2010, 05:23 PM.

              Comment


                #8
                Re: Help to Place LAST selection at END of List

                Thanks Gabe... I had already tested that and fixed it. I also updated it so that it would work with selections having two or more words. Here again is my latest revision:


                'code------

                'begin code

                dim a_List as C
                dim List1 as c
                dim vList as c
                a_List = <<%str%
                c1
                c2
                c3
                c4
                c5
                c6
                c7
                t1
                t2
                t3
                t4
                t5
                t6
                t7
                t8
                t9
                t10
                t11
                t12
                l1
                l2
                l3
                l4
                l5
                Left Hip
                Right Hip
                Upper Extremity
                Lower Extremity
                Sacrum
                Pelvis
                %str%



                ok_button_label = "&OK"
                cancel_button_label = "&Cancel"

                varC_result = ui_dlg_box("Dysfunction",<<%dlg%
                {Windowstyle=Gradient Horizontal}

                {region}{font=Arial,10}
                {sp=1}[%m;h;O={@@};C=20%.112,10vList^#a_List]{watch=vList!fooList}
                {endregion};

                {region}
                {color=Red on #254+254+235}{font=Tahoma,9}{sp=1}[%MW%.112,4vFinalList]{watch=vFinalList!fooDysList}
                {endregion};

                {Region}{justify=center}{color=""}
                <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
                {endregion}
                %dlg%,<<%code%

                if a_dlg_button = "fooList" then
                dim removelist as c = ""
                a_dlg_button = ""
                if vList > "" then
                List1 = List1+vList
                List1 = word_unique(List1, crlf() )

                for each foo in List1
                dim name_exists as l = is_one_of(foo.value, vList) 'dim name_exists as n = word_occurs(vList, foo.value)
                if name_exists = .f. 'if name_exists = 0
                removelist = foo ' word_subtract(List1, foo.value, crlf())
                end if
                next
                List1 = word_subtract(List1, removelist, crlf())

                a_dlg_button = ""
                vList2= if(w_count(crlf_to_comma(List1),",")>1,strtran(stuff(crlf_to_comma(List1),at(",",crlf_to_comma(List1),-1),1," and "),",",", "),crlf_to_comma(List1))
                vList2 = f_upper(vList2)
                vFinalList = vList2

                else
                vFinalList = ""
                end if
                end if


                %code%)

                '---end code

                Comment


                  #9
                  Re: Help to Place LAST selection at END of List

                  Gabe,
                  I see yours also works with two word selections. Though I like having spaces after the comma ;)

                  Comment


                    #10
                    Re: Help to Place LAST selection at END of List

                    FWIW: Alpha used to (many versions ago) show all selection lists from xdialogs in the order they appeared in the xdialog. Later they changed it so the last item selected was at the top of the list. Obviously this was done to enable the developer to determine which item was selected last.

                    I believe it simply goes back to the original order when something is unselected.

                    I haven't even looked at the solutions presented here. I just wanted to mention this in case it helps understand what's going on.

                    Comment


                      #11
                      Re: Help to Place LAST selection at END of List

                      I couldn't resist the challenge. I tried it without looking at what had already been done (didn't want to get pushed into a rut not of my own choosing) and here's what I came up with.

                      Notes:
                      1. This does NOT work if you use the "e" option to make it selectable as in Windows Explorer.
                      2. This assumes that there are no duplicates in the list.

                      Code:
                       
                      inlist = <<%list%
                      a
                      b
                      c
                      d
                      e
                      f
                      g
                      h
                      i
                      j
                      k
                      l
                      %list%
                      clist = ""
                      last_selected = ""
                      dlg_text = <<%dlg%
                      {ysize=.3}{units=F}{font=arial,9,n}{sp};
                      [%m%.20,20chcs^#inlist!inl_*];
                      {sp};
                      {justify=center}<*15OK> <15Cancel>
                      %dlg%
                      DIM dlg_result as C
                      dlg_result = ui_dlg_box( "TEST", dlg_text, <<%code%
                      IF left( a_dlg_button, 4 ) = "inl_"
                          IF a_dlg_button = "inl_change"
                              last_selected = word( chcs, 1, crlf())
                              [COLOR=blue]'surround with crlf() so we are sure we are checking for the whole word.[/COLOR]
                              IF (crlf() + last_selected + crlf()) $ ( crlf() + clist )
                                  [COLOR=blue]'Since the "last selected" is already in the list, something was deleted.[/COLOR]
                                  new_clist = ""
                                  clist = crlf() + clist
                                  lcnt = w_count( clist, crlf() )
                                  FOR qx = 1 to lcnt
                                      this_word = word( clist, qx, crlf() )
                                      IF (crlf()+this_word+crlf()) $ (crlf() + chcs)
                                          *concat( new_clist, this_word + crlf() )
                                      END IF
                                  NEXT
                                  clist = new_clist
                              ELSE
                                  clist = clist + last_selected + crlf()
                              END IF
                          END IF
                          a_dlg_button = ""
                      END IF
                      %code%)
                      clist = alltrim( clist )
                      ui_msg_box( "", "Last selected:" +crlf()+ last_selected +crlf(2)+ "List as selected:" +crlf()+ clist +crlf(2)+ "Last chcs list:" +crlf()+ chcs )

                      Comment


                        #12
                        Re: Help to Place LAST selection at END of List

                        Cal,

                        Cool. Thanks for sharing.

                        Don

                        Comment

                        Working...
                        X