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

Editing layouts in runtime

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

    Editing layouts in runtime

    I was going to just hard code with a5_layout_design(), but that did not give the functionality I needed. Then I found Mike Reed's contribution on the message board which got me started. Thanks Mike! I expanded his code for running as a function, and added features I needed. It now works for all layout types.

    Sample usage.
    Code:
    p_layout_design()	'let user select any report to edit
    p_layout_design("mytable.dbf", "myreport")	'let user edit any report in mytable.dbf, myreport is default selection.
    p_layout_design("mytable.dbf,myset.set","","letter")	'edit any letter in 1 table and 1 set.
    p_layout_design("mytable.dbf", "myreport","",.t.)	'immediatly open editor for myreport.  no user selection.
    Now I need some help! Line 102 in the code is undocumented and does not even show in function autocomplete. (Where did you get it Mike?) It works, but I really need to be able to preselect the tables/sets that can be used.

    Bill.

    OK, attachment is correct.
    Last edited by Bill Parker; 03-07-2009, 07:02 PM.

    #2
    Re: Editing layouts in runtime

    I still need to build a custom help lookup for tablesetname. For some reason parameter help for layoutname has worked sometimes to show list, but mostly not. I am supprised I did not find Alpha help coded for layouttype, so I need to do that as well.

    Bill.

    Comment


      #3
      Re: Editing layouts in runtime

      I have fixed a small bug. If a layout name is duplicated in 2 tables, but only 1 table was selected for processing. If the duplicate layout name is picked, the wrong copy might open for editing.

      I'll wait to see if anything else turns up before posting the fix.

      Bill.

      Comment


        #4
        Re: Editing layouts in runtime

        Bill,
        I still need to build a custom help lookup for tablesetname. For some reason parameter help for layoutname has worked sometimes to show list, but mostly not.
        You didn't say if this was wanted to be done from withing the function or outside of it...I would approach it with the following in that I think it would be the easiest.

        UI_GET_TABLE("Choose a Table or Set from the List", "Both")

        This could be used in the script within the function or you could incorporate it into the function itself if wanted as an argument that would have the list come up when right clicked.

        Another way would be to use "setname" and "tablename" for 2 arguments in the function--each would present the dropdown list of sets or tables respectively.

        Regarding the "layoutname"...is or does it bring up a list of layouts? I cannot find a function of Alpha's that uses it and when I created a function using it no list appeared. Regardless, you could create your own using the addin.function_argument_help() function if really wanted.
        Last edited by MikeC; 03-07-2009, 08:44 PM.
        Mike
        __________________________________________
        It is only when we forget all our learning that we begin to know.
        It's not what you look at that matters, it's what you see.
        Henry David Thoreau
        __________________________________________



        Comment


          #5
          Re: Editing layouts in runtime

          Mike,

          I will ultimately build parameter help using the addin.help stuff. Not too critical since the developer might supply a crlf() list of tables that they would build themselves anyway. Currently the parameter tablesetname gets help from Alpha's setname help. But the extension is needed since tables and sets can be mixed.

          All in all, since this is help for the developer and not the user, I figure we can handle it!

          Bill.

          Comment


            #6
            Re: Editing layouts in runtime

            Hi Bill,

            Originally posted by Bill Parker View Post
            Line 102 in the code is undocumented and does not even show in function autocomplete.
            It should show in autocomplete (at least it does in mine). But autocomplete often doesn't get updated for reasons's I can't figure out. It can be rebuilt (at least for user's functions), but even then, it seems to take a couple of restarts of A5 to have it effective. There are 2 functions involved with that help it regenerate. I always lose them and then have to search for them again!:)

            Anyway, if you can't get the autocomplete, always try something like

            Code:
            ?function_prototype_get("a5_new_report_dialog")
            = "P a5_new_report_dialog([C type [,C prompt [,C title [,C table_set_list [,C alias_names [,L exclude_tables ]]]]]])"
            ?function_description_get("a5_new_report_dialog")
            = "Displays the New Report/Label/Letter dialog box"
            ?function_limitations_get("a5_new_report_dialog")
            = "H"
            Regards,

            Ira J. Perlow
            Computer Systems Design


            CSDA A5 Products
            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
            CSDA Barcode Functions

            CSDA Code Utility
            CSDA Screen Capture


            Comment


              #7
              Re: Editing layouts in runtime

              Hi Bill and Ira,

              Here is some sample code for the:

              a5_new_report_dialog([C type [,C prompt [,C title [,C table_set_list [,C alias_names [,L exclude_tables ]]]]]])"

              that corrects an issue with the example given in the Runtime+ PDF Help file. The example in the runtime+ help file did not show how to properly initialize the table_set_list parameter in order for the logical .f. flag to exclude_tables. The table_set_list needs to be populated with the same tables and sets list as the alias_list.

              Dim alias_file as c
              Dim alias_list as c
              Dim table_set_list as c
              Dim Prompt as c
              Dim dlg_title as c
              alias_file = a5.get_exe_path() + chr(92) + "TableAliases.txt"
              If file.exists(alias_file) then
              alias_list = get_from_file(alias_file)
              table_set_list = get_from_file(alias_file)
              Else
              alias_list = ""
              table_set_list = ""
              End if
              Prompt = "Select the data source for your new report�"
              Dlg_title = "New EZ Task Master Report"
              a5_new_report_dialog("report",prompt,dlg_title,table_set_list,alias_list,.f.)


              Hope this is helpful.

              Kind regards,
              Gordon
              SCS


              Originally posted by csda1 View Post
              Hi Bill,



              It should show in autocomplete (at least it does in mine). But autocomplete often doesn't get updated for reasons's I can't figure out. It can be rebuilt (at least for user's functions), but even then, it seems to take a couple of restarts of A5 to have it effective. There are 2 functions involved with that help it regenerate. I always lose them and then have to search for them again!:)

              Anyway, if you can't get the autocomplete, always try something like

              Code:
              ?function_prototype_get("a5_new_report_dialog")
              = "P a5_new_report_dialog([C type [,C prompt [,C title [,C table_set_list [,C alias_names [,L exclude_tables ]]]]]])"
              ?function_description_get("a5_new_report_dialog")
              = "Displays the New Report/Label/Letter dialog box"
              ?function_limitations_get("a5_new_report_dialog")
              = "H"

              Comment


                #8
                Re: Editing layouts in runtime

                Gordon,

                I still have issues here. I provide a list of tables/sets, and that displays filne as long as I don't mess with the exclude_list. The problem is that Alpha automatically adds a first entry at the top of the list
                <SQL Data Source>

                My desire is to remove that entry from the list. From testing, my guess is that is not possible.

                Code:
                if layoutname = "(Create a New Layout)"
                	a5_new_report_dialog(layouttype,"","",table_set_list)
                else
                ...
                works, but adds the sql data source in the list.

                Code:
                if layoutname = "(Create a New Layout)"
                	exclude_list = "<SQL Data Source>" +crlf() +table_set_list
                	table_set_list = exclude_list
                	a5_new_report_dialog(layouttype,"","",table_set_list, exclude_list,.t.)
                else
                ...
                includes everything but my list of tables while still including <SQL Data Source>. It seems that if an exclude_list is provided, table_set_list is ignored.

                Having <SQL Data Source> display is not a killer for me, as confusing as it might be for users, so I am just moving on.

                Bill.

                Comment


                  #9
                  Re: Editing layouts in runtime

                  Attached is the latest version. Still has the problem that <SQL Data Source> shows, but it now works with tables that are not attached to the database - something that was useful to me. But remember, if you are using detatched tables you must use fully qualified layout names in other scripts where you may be printing these reports.

                  Bill.

                  Comment


                    #10
                    Re: Editing layouts in runtime

                    There is a problem when the function is run in the context of a form (from a button), and the dictionary with the layout is not attached to the database.

                    In that case the layout is not found the first time the function runs. See attachment. As long as the form remains open, all subsequent runs work fine. But close and reopen the form and the first execution gets the error.

                    The error never occurs if the function is run from interactive window.

                    The error occurs on
                    a5_layout_design(layoutname,layouttype)

                    With that little to go on, can anyone speculate on a cause?

                    The code could attach the table before the command and detach it afterward, if I don't find a solution.

                    Bill.

                    Comment


                      #11
                      Re: Editing layouts in runtime

                      Hi Bill,

                      Originally posted by Bill Parker View Post
                      There is a problem when the function is run in the context of a form (from a button), and the dictionary with the layout is not attached to the database.

                      In that case the layout is not found the first time the function runs. See attachment. As long as the form remains open, all subsequent runs work fine. But close and reopen the form and the first execution gets the error.

                      The error never occurs if the function is run from interactive window.

                      The error occurs on
                      a5_layout_design(layoutname,layouttype)

                      With that little to go on, can anyone speculate on a cause?

                      The code could attach the table before the command and detach it afterward, if I don't find a solution.

                      Bill.
                      You'll need another solution.

                      Alpha uses a5_op_name_short_to_long() in the a5_layout_design() function which looks at the objects in the current control panel and returns the long version (objectname@dictionaryname) format for an object type. Unfortunately, passing the long version of an argument still fails, as it requires that it be in the control panel. However, it returns "" if the object is not attached to the current database, which is almost certainly the cause of your failure.
                      Regards,

                      Ira J. Perlow
                      Computer Systems Design


                      CSDA A5 Products
                      New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                      CSDA Barcode Functions

                      CSDA Code Utility
                      CSDA Screen Capture


                      Comment


                        #12
                        Re: Editing layouts in runtime

                        Thanks Ira,

                        a5_op_name_short_to_long() used to also check external dictionaries. It has been rewritten, so more difficult for me to tell what it does now.

                        But that would not explain why it only fails on first button press, and works if button is pressed a second time.

                        Bill.

                        Comment


                          #13
                          Re: Editing layouts in runtime

                          Bill, Ira,
                          Am curious. If when the error happens and it returns a "", then is it possible to trap this error and test for if the result ="" to have it run a second time??
                          Mike
                          __________________________________________
                          It is only when we forget all our learning that we begin to know.
                          It's not what you look at that matters, it's what you see.
                          Henry David Thoreau
                          __________________________________________



                          Comment


                            #14
                            Re: Editing layouts in runtime

                            Mike,

                            Unfortunately no. a5_layout_design() runs asychronously, so the calling script continues running. It does not return a value.

                            Bill.

                            Comment

                            Working...
                            X