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

Xdialog List Box Scrolling Help

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

    Xdialog List Box Scrolling Help

    Hello,

    I am trying to come up with a routine to base a newsletter article on but I am running into an issue that I haven't been able to figure out. In an Xdialog list box I want to be able to scroll the list up so the selected item is at the top of the list. See the following sample:

    vList =;
    %dlg%,

    #2
    RE: Xdialog List Box Scrolling Help

    Hi Jim,

    I am not sure if if this is what you are looking for but if not I have got something else that you may like to try. Have this for the moment, run it in Alpha Sports.

    Keith Hubert
    Guild Member
    London

    'Created By :Keith Hubert
    'Updated By :Keith Hubert
    DIM SHARED a_selected[100] as C
    DIM SHARED varC_result as C

    auto_list_cities = table.external_record_content_get("customer","Bill_city","Bill_city","unique_key_value()")
    temp_count = w_count(auto_list_cities,crlf())
    DIM a_cities[temp_count] as c
    a_cities.initialize(auto_list_cities)
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Print Report",
    {endregion};
    %dlg%, "" then
    filter = alltrim(cities)
    filter = *for_each(x,"bill_city = " + quote(x), filter)
    filter = alltrim(filter)
    filter = stritran(filter,crlf()," .or. ")
    report.preview("Customer List",filter)
    end if
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      RE: Xdialog List Box Scrolling Help

      Hello Keith,

      Thanks very much for your neat example. Xdialog is really a wonderful tool!

      What I am trying to do is get the list box in Xdialog to scroll. The progressive lookup article I did in the June issue of the newsletter has garnered more feedback for me, that any other article. This technique is quick and easily built. However, it has one glaring weakness; it queries the table everytime a keystoke is entered. On a large table or over a network, this creates an unacceptable time lag. I am trying to revisit this issue for the pages of the newsletter and have gotten most of the pieces to work. However, I do not know how, or if it is possible, to scroll the list box as I want.

      I think this is important in a progressive lookup. As the user types in values, they need to be able to see the first current match, to the values they have typed in, and the subsequent 'potential' matches. In other words, if I type in "sm", I want to see the "smiths" and "smyths", not just the first "smith" at the bottom of the list box.

      Thanks,

      Jim

      Comment


        #4
        RE: Xdialog List Box Scrolling Help

        Jim,

        You are probably smart enough to figure out how to use this.

        If the dialog opens to the last entry in the list and you then begin typing a name higher, alphabetically, the list scrolls to the first name with that letter at the top of the dialog list and the other names beginning with that letter are visible.

        I believe this is the result you want, is is doable and viable?

        Stan
        There can be only one.

        Comment


          #5
          RE: Xdialog List Box Scrolling Help

          btw, this opens with the last entry visible

          'Date Created: 15-Dec-2003 08:20:26 AM
          'Last Updated: 15-Dec-2003 08:20:26 AM
          'Created By :
          'Updated By :
          vList =vSelect = left(word(vlist,-1),1)
          ui_dlg_box("Testing",
          There can be only one.

          Comment


            #6
            RE: Xdialog List Box Scrolling Help

            Hello Stan,

            An interesting approach, I would never have thought of that. This works, but only if the user sequentially enters the correct characters. If they back up or start over, I'm back to the same issue.

            I can filter the list and present a 'new' list to the user, which simulates what I want to achieve, but this causes rather slow screen refreshing when dealing with even a rather small table (5000 records or so).

            For all I know, this may not be possible with Xdialog in its present form, but I've got to think there is an 'undocumented' command in there somewhere :-)

            Thanks for your help Stan,

            Jim

            Comment


              #7
              RE: Xdialog List Box Scrolling Help

              Took about 15 minutes but it was a fun challenge. I did it completely with strings but it could also be done with a couple arrays - I'm not sure which would be faster.

              (I hope I got the HTML "pre>..."/pre> right!)

              Code:
              vList =  1
                      FOR qx = crnt_pos to cnt
                          temp_list = temp_list + word(vOrigList,qx,crlf()) + crlf()
                      NEXT
                      FOR qx = 1 to (crnt_pos-1)
                          temp_list = temp_list + word(vOrigList,qx,crlf()) + crlf()
                      NEXT
                      vlist = temp_list
                  END IF
                  '=======================
              END IF
              %code%)

              Comment


                #8
                RE: Xdialog List Box Scrolling Help

                Close...

                I get an error if the first letter of the entered name (string) is not valid (no name beginning with that letter is in the list). I think it just means crnt_pos needs to be intialized before it is first referenced.
                There can be only one.

                Comment


                  #9
                  RE: Xdialog List Box Scrolling Help

                  You're right. I forgot to check for "doesn't exist". The original also didn't reset to the top when you back-spaced until the input field was blank. It also created an error if you typed a first letter that was higher than the last value.

                  Try putting in this new WHILE statement: (Yes, the IF might better be a SELECT statement but it started as an IF and I didn't bother to change it.)

                  [code]
                  WHILE qx

                  Comment


                    #10
                    RE: Xdialog List Box Scrolling Help

                    I just noticed that I forgot to remove the LastTest variable that I used in my first attempt to fix the problem.

                    Also, an interesting result: If you type "chu" and exit the dialog, the result will be Chuck (the value from the list rather than the value you typed) but if you type "ed" or any other value that has no match in the list, the returned value will be the value you typed......

                    Later: I had to take the time to fix the above problem - so here's one solution. (Note: You might WANT to use the unmatched value so the following would only be used if you DON'T want to allow unmatched results.)

                    Code:
                    IF a_dlg_button = "changed"
                        a_dlg_button = ""
                        vSelect = vTypeIn
                        '=======================
                        match = .F.
                        qx = 0
                        WHILE qx  1
                            FOR qx = crnt_pos to cnt
                                temp_list = temp_list + word(vOrigList,qx,crlf()) + crlf()
                            NEXT
                            FOR qx = 1 to (crnt_pos-1)
                                temp_list = temp_list + word(vOrigList,qx,crlf()) + crlf()
                            NEXT
                            vlist = temp_list
                        END IF
                        '=======================
                    END IF
                    Then use this after the xdialog is closed - of course, you can take any action you want based on the results of "match".
                    Code:
                    IF .not. match
                        vSelect = ""
                    END IF
                    ui_msg_box( "RESULT", vSelect )

                    Comment


                      #11
                      RE: Xdialog List Box Scrolling Help

                      Hello Cal,

                      You got me exited there. I am at fault for not presenting my question better. I am trying to get a progressive lookup to function well in a real world environment. I went down the same road as you. The problem is with a list (generated from a table) the refresh time is too slow.

                      Here is my actual first try script, which is way to slow. I've attached a database with a 4000 record table and the script. As you can see the refresh time is not good :-)

                      Thanks,
                      Jim

                      Code:
                      t = table.open("customer2")
                      DIM SHARED vList as C
                      vndx = t.index_primary_put("Testlist")
                      vRecNum = vndx.records_get()
                      vlist = vndx.key_list_get(vRecNum)
                      
                      t.close()
                      
                      vlist = *for_each(x,word(x,1)+"{T=.75}"+" "+word(x,2)+space(40)+word(x,-1),vlist)
                      
                      DIM SHARED vTypeIn as C
                      DIM SHARED vSelect as C
                      DIM SHARED varC_result as C
                      auto_list_vSelect = vList
                      
                      temp_count = w_count(auto_list_vSelect,crlf())
                      DELETE a_vSelect
                      DIM a_vSelect[temp_count] as c
                      a_vSelect.initialize(auto_list_vSelect)
                      
                      ok_button_label = "&OK"
                      cancel_button_label = "&Cancel"
                      varC_result = ui_dlg_box("Select A Customer", 
                      {endregion};
                      %dlg%, 1
                      		vFeedString = word(vTypeIn,1)+"{T=.75} "+word(vTypeIn,2)
                      		else
                      		vFeedString = alltrim(vTypeIn)
                      	end if 
                      	vFilter = vFeedString+"*"
                      	vList2 = filter_string_smatch(vList,vFilter)
                      	a_vSelect.clear()
                      	a_vSelect.initialize(vList2)
                      end if 
                      profiler_end()
                      %code%)
                      
                      if varC_result = "OK" .and. (.not. (vSelect = ""))
                      	ui_msg_box("Selected",vSelect)
                      end if

                      Comment


                        #12
                        RE: Xdialog List Box Scrolling Help

                        Hello,

                        For any of you following this thread, I have attached a database with my latest script called DumpArrayApproach.
                        This works against a 4000 record table with a pre-built index. The formatting of the Xdialog list box is not done. Performance is acceptable running locally, but when I increace the table to 24,000 records, the performace degrades significantly. Below is the script. If I could scroll the list box rather than 're-write' the list, I think performance would be much better. Any thought on how to improve the performance?

                        Thanks,
                        Jim

                        Code:
                        profiler_begin()
                        t = table.open("customer2")
                        DIM SHARED vList as C
                        Dim vTypeIn as c
                        vndx = t.index_primary_put("Test2")
                        vRecNum = vndx.records_get()
                        vlist = vndx.key_list_get(vRecNum)
                        t.close()
                        
                        dim vArray[vRecNum] as p
                        
                        vArray.initialize_properties("Name, Recs",vlist)
                        vDisplay = vArray.dump_properties("Name, Recs")
                        profiler_end()
                        ui_dlg_box("Testing",
                        %dlg%,='"+vTypeIn+"'"
                        	vDisplay = vArray.dump_properties("Name, Recs",vFilter)
                        end if 
                        %code%)

                        Comment


                          #13
                          RE: Xdialog List Box Scrolling Help

                          For those interested, here is the script profile timing on a 24,000 record table, running on an old 1ghz machine with 768 megs of memory, slow HD:

                          Script TEMPLATE
                          Line Tot Time Cnt Source
                          ========================================================
                          5 0.012543 1 t = table.open("customer")
                          6 0.000066 1 DIM SHARED vList as C
                          7 0.000068 1 Dim vTypeIn as c
                          8 0.000705 1 vndx = t.index_primary_put("Test2")
                          9 0.027958 1 vRecNum = vndx.records_get()
                          10 1.003916 1 vlist = vndx.key_list_get(vRecNum)
                          14 0.000968 1 t.close()
                          16 0.010792 1 dim vArray[vRecNum] as p
                          18 1.455741 1 vArray.initialize_properties("Name, Recs",vlist)
                          19 1.223627 1 vDisplay = vArray.dump_properties("Name, Recs")
                          ========================================================
                          ========================================================

                          The times do not appear to bad, but each user keystroke will cause a filtered array dump (line 19). Depending on the filter, this could be another 1.2 seconds for the list box to re-write for each keystroke.

                          Comment


                            #14
                            RE: Xdialog List Box Scrolling Help

                            I think I may have something but I also think it's time for some sleep - my wife will be getting up in about 2 hours.

                            Comment


                              #15
                              RE: Xdialog List Box Scrolling Help

                              Never mind - I was doing basically the same thing with .dump_properties.

                              Comment

                              Working...
                              X