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 listbox refresh

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

    xdialog listbox refresh

    Is Xdialog-listboxing a hard thing or what? My several attempts to keep listboxes fresh with current records have failed.

    I'm attempting to use Keylist_build() a lot in my xdialogs because I like the column separators and such. I filter the keylists to show whatever records the user is looking for. When I add/edit/delete records from the listbox's selected table, the listbox won't display properly. Sometimes I have to close the dialog all together and reopen just to display the proper updated records. What would be the best bet for updating a listbox in xdialog?

    Do I refresh the dialog? ui_dlg_refresh()
    Do I refresh the keylist_build() + Filter again?
    Do I close the dialog and reopen it, but how to keep it looking smooth during the transition?

    I mean instead of hammering this for weeks, could someone share their genius thoughts on this topic? Thank you so much for all the previous help you've given me!

    #2
    Re: xdialog listbox refresh

    I'd suggest that you put the code that creates the listbox into a function.

    To see listbox changes without closing the xdialog you have to refresh the listbox. So, when you "add/edit/delete records from the listbox's selected table" you should call the function above to redisplay the listbox contents. If the changes are made in the same xdialog you could add the function to the change code or to an event related to that change.
    Finian

    Comment


      #3
      Re: xdialog listbox refresh

      This is how I refresh the record-list listbox. It's basically suppose to refresh the listbox based on the filter I supply. So when I add/edit/delete an item, the listbox should refresh and show the updated information. It doesn't and I don't know how to accomplish this same multi-column record-list listbox without keylist_build() and the filter. Using a function outside of the main function, to repopulate the listbox, is something I don't see how that would work.
      Actions:
      1. FT = "WO_ID="+Current_Order
      2. Tasks = "KL=workorders_tasks,{keylist_build('H=.025,1:0[],2:80[Description],3:10[Quantity],4:10[Time]',''+WO_Task_Usage,invert(''+Time),alltrim(Description),''+Quantity,''+Time)}{"+FT+"}"
      3. ui_modeless_dlg_refresh(Title)

      Comment


        #4
        Re: xdialog listbox refresh

        Sound good?

        1. I define several variables before an xdialog opens. They are blank at first.
        2. I have a Listbox populated by keylist_build().
        3. As a used doubleclicks a selection in the listbox, the variables are loaded with their appropriate values.
        4. After that the dialog "changes views" which only means a conditional area is shown. In it are editboxes and such that display these variables for the user to see.
        5. So at this point the editboxes should have updated information.

        The refreshing of values works only sometimes, the times it doesn't work include when I run an external function that changes the record behind the scenes and then returns back to the xdialog.
        I feel like the values are being updated, since they are actually in tables, but the dialog isn't wanting to update itself. Closing and reopening will fix the problem, but that's not my goal.

        Should I be ui_dlg_refresh()'ing if the variables are defined within the same function? Should I make the main xdialog a modeless one, and the refresh will work better? How do other people show variables, change the values, and instantly refresh the display.

        Also, listboxes don't like to be add/edit/delete 'd from I guess. Since if I delete a record that the listbox is showing, all other records visually disappear and I am left with the one value I deleted. Kind of confusing. Only if I close the xdialog and reopen do the records come back and show the correct information. I have events that are suppose to reload the listbox with a filtered keylist_build() but instead do nothing. How can I do this?

        Thank you so much for reading this...this board is great!

        Dan

        Comment


          #5
          Re: xdialog listbox refresh

          Dan:

          It's easier to help on something like this with a code sample and, in your case, sample tables as well.

          A refresh (dlg_refresh) is not required to redisplay records from a table. When you re-run a query and update the values in the array on which the box is based, the new values should be displayed automatically. This is the case whether the xdialog is modal or modeless so I wouldn't change that and expect a different result from what you are currently getting.
          Finian

          Comment


            #6
            Re: xdialog listbox refresh

            Finnian,

            I'm

            Comment


              #7
              Re: xdialog listbox refresh

              Here's two "Cases" from my xdialog. One Case "Delete_Task" deletes the selected record. The Other Case "Refresh_Tasks" is intended to refresh the record-listbox and show all records remaining that match my filter. This is all so familiar to me right now, if there's any confusion please let me know.

              What happens is:
              1. I click the "Delete" button which calls this event.
              2. The Delete event removes the "Task" record from "workorders_tasks" table.
              3. The refresh event is suppose to reload the keylist shown in the listbox.

              The "Task" does get deleted from the table, but the listbox does not show the removal. I have to close the whole dialog (which is kinda big) to reload the listbox. Please help, thank you...


              Code:
              	case a_dlg_button = "Delete_Task"
              		FT = "WO_ID="+Current_Order+".AND.WO_Task_Used="+Selected_Task
              		IF tablecount("workorders_parts",FT) > 0 Then
              			Result = ui_msg_box("Confirmation","Are you sure about deleting this task? If any parts are attached they will be returned to inventory!",UI_YES_NO)
              	 		IF Result = ui_yes_selected THEN
              				WO_Task_Removal(Current_Order,Selected_Task)
              			END IF
              		Else
              			WO_Task_Removal(Current_Order,Selected_Task)
              		END If
              		ui_dlg_event(Title,"Refresh_Tasks")
              		ui_modeless_dlg_refresh(Title)
              		a_dlg_button = ""
              	case a_dlg_button = "Refresh_Tasks"
              		FT = "WO_ID="+Current_Order
              		Task_Count = tablecount("workorders_tasks",FT)
              		If Task_Count > 0 then
              			Tasks = "KL=workorders_tasks,{keylist_build('H=.025,1:0[],2:80[Description],3:10[Quantity],4:10[Time]',''+WO_Task_Usage,invert(''+Time),alltrim(Description),''+Quantity,''+Time)}{"+FT+"}"
              			Selected_Task = tablemax("workorders_tasks",FT,"WO_Task_USage")
              		end if
              		ui_modeless_dlg_refresh(Title)
              		a_dlg_button = ""

              Comment


                #8
                Re: xdialog listbox refresh

                Much better, here's an example I put together. So simple. Please help. Thank you.

                Comment


                  #9
                  Re: xdialog listbox refresh

                  Daniel, you're asking a good question. I've found examples showing how to refresh list boxes in other threads, but nothing that shows how to do it with a record-list list box such as you're using here. I'll be watching this thread to see what suggestions arrive, but it seems to me you're going to have to rebuild the list after you code manipulates the underlying table, if this even possible with this type of list box.

                  FYI, here's a thread that contains an example from Dr. Wayne illustrating how to refresh a simple list box in a modeless xdialog. http://msgboard.alphasoftware.com/al...dialog+refresh

                  Comment


                    #10
                    Re: xdialog listbox refresh

                    Daniel:

                    I was about to upload a sample file when I see you've posted a dowload. I'll take a look at that before responding further.

                    I misspoke earlier when I said that you should be able to refresh without a ui_dlg_refresh command. The only way I could get the listbox to refresh (when a table action, like a deletion, was carried out with xbasic) was, indeed, with ui_dlg_refresh.

                    The listbox built with keylist_build seems to behave differently from those built with an array based on table.external_record_content_get.
                    Finian

                    Comment


                      #11
                      Re: xdialog listbox refresh

                      While I'm looking at your zip, here's the sample I was working on. This one, however, is a modal dialog.
                      Finian

                      Comment


                        #12
                        Re: xdialog listbox refresh

                        Sorry, here's the zip file.

                        BTW, I just noticed the issue you mentioned with deleting the first record in the list. It happens here too.
                        Finian

                        Comment


                          #13
                          Re: xdialog listbox refresh

                          Unfortunately I'll have to accept that this is an alpha issue and not my fault... :)

                          BTW, thank you for that small app. I can learn a lot from it. I don't know about local_variables() and alternating row colors...so it will be some food for thought... Thanks again guys...

                          Maybe if I'm lucky someone will come up with a solution... as I work around the problem...

                          :) happy day,
                          Dan

                          Comment


                            #14
                            Re: xdialog listbox refresh

                            Dan:

                            I followed Tom's lead and took a look at the sample that Peter Wayne posted. As usual, Peter has the key, which is setting the value of the return variable to the value of the last item in the displayed list. When you do this, the box is automatically updated.

                            In the attachment, I have that value hard coded - although you will see remmed out code where I would otherwise get it directly from the table. The problem is that the listbox order is set to a character sort and the field in the table is numeric. The code in the example will work as long as there are more than 10 items in the list! If you change the table field type to character and pad the values so that the table and list sorts are the same you can derive the value as I show in the remmed out code.

                            To set the value of the last item I guessed that the format was
                            fieldname1 +"|"+fieldname2
                            which is similar to the format used in other xdialog lists and it appears to be correct. I couldn't see any way to actually see the data on which the keylist was built.

                            The code in this version does update the keylist after an addition or deletion, then sets the return variable value. It does not work unless the list is updated. It does not use the dlg_refresh. It also works when you delete the first item in the list.

                            Oops ... I just checked this in V7 (I was doing the testing in V8) ... In this sample I enlarged the list box. In V8, after an addition or deletion, the whole list displays properly. In V7, it shoots the last item to the top of the box and you have to scroll the list down to see the change.
                            Finian

                            Comment


                              #15
                              Re: xdialog listbox refresh

                              Well that's the thing, I did set the return value to the item I wanted displayed next. Somehow yours doesn't misbehave as mine did. Maybe setting the return value with (value + "|" + info) does the trick, or maybe tasking the focus away from the dialog with the localvariables and that function....maybe that did it... my next step was to put keylist_builds into my indexes of the table and filter the index using a global variable that is set whenever I want to show whatever I need at the time...I was wondering if that would work.

                              Thank you I'm gonna try more stuff and get this correct if I can...
                              I'm thinking about setting focus to the listbox, then sys_send_keys("{HOME}")
                              to bring the list back to the top...if that's the case, then problem solved...

                              I'm going to lunch...thank you so much.
                              dan

                              Comment

                              Working...
                              X