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



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

Run-away code

  • Filter
  • Time
  • Show
Clear All
new posts

  • Run-away code

    I have a button the OnPush event for this button calls up a "home made Lookup" form containing a browse. The idea is that the user selects a "Sales_Order number" from the browse and the choice is assigned to a global variable (sales_search). The remaining code in the button is as follows:


    My problem is that ALL the code is run during the OnPush event. The effect is that on pushing the button the "lookup" form appears I can choose a record press the OK button to make the lookup disappear and unfortunately, the Sales_Order number fails to change.

    When I press the button again the Sales_Order number I had chosen previously appears. Is there a way to get the button code to stop just after I call up the "lookup form" and resume after I make my choice?

  • #2
    RE: Run-away code


    The best way is to open the browse form as a dialog. This has two effects. First, it will stop the script until the dialog is closed. Second, it will deactivate all menus and toolbars. So you need some way to "close" the browse form. The x in the upper right works. Check the xbasic manual on opening forms as dialogs. Here is an example.

    p_frm = :Form.load("SelectInventory","dialog")
    ml = (ui_info(2)-p_frm.width)/2
    p_frm.left = :A5.left+ml =


    The top and left lines is something I added to set the location of the dialog at the upper left corner of the opening form. One thing about dialogs. Not all events fire when a form is opened as a dialog. OnInit does, but Onactivate does not for example.



    • #3
      RE: Run-away code


      I forgot one line. Since closing a dialog from the dialog form only hides the form, the dialog must be explicitly closed with xbasic. Add the following line at the end.




      • #4
        RE: Run-away code

        I tried to load the form as dialog and I also included the close() command. Curiously enough, when I press the button there is a quick flash probably the "lookup form" and then nothing. When I press the button again I get:

        Trapped error in action command (1)
        Command Inline Basic
        Error variable type mismatch

        I also noticed that under the Xbasic explorer that after this happens I end up with 3 session running when I should have 1. The "lookup" form is simply a form with a browse and 2 buttons. In the oninit a branching operation puts a value into a variable depending on the value of a text object previously set. Button1 is an OK button where the chosen value is shoved into a variable button 2 is a cancel button.

        After I close down Alpha5 I get:

        Trapped error in action command (1)
        Command Inline Basic
        error bad object handle

        When I reopen the program and change the code back to the following everything works fine again. except for the problems in the beginning. The program seems to ignor the dialog command

        DIM layout_ptr as P
        if is_object("pop_orders") then
        layout_ptr = :Form.load("pop_orders")
        end if


        • #5
          RE: Run-away code


          Using dialogs is one area where care is paramount. Any error can prevent the dialog from closing and the error may not be trapped anywhere. Every time the form opens, it stays open until the app is closed and reopened. Been there, done that, too many times to mention. The script I posted was a cut and paste from a working script.

          The error you are getting would indicate that there is a problem in you form you are opening with a variable definition in an action script. Try eliminating any reference to the variable and see if the error goes away.

          If not, how about zipping up the tables and related files without data and posting them.



          • #6
            RE: Run-away code

            Thanks for the help, I am really sorry to have put you through having to write all that explanation down. I finally have the problem licked, it turns out that my 13 year old son dropped the form.load script in for all intents and purposes it did the job but we were unaware of all the stuff going on in the background. Anyway I decided to start from scratch with another button and used the handy dandy Xbasic Explorer. The form.view("formname","dialog") with the formname.close() worked like a charm!

            Thanks again!


            • #7
              RE: Run-away code


              Glad you got it to work. Just for your information, I accidentally ran into the same opening problem you had where the form would blink and disappear. Here is what I found.

              The problem was in the form that was opening as a dialog. I added a command to the OnInit event and this created the problem. When I moved the same command to the OnFetch event (which also fires on a dialog), the form opened normally as a dialog. Interestingly, the form opened as a standalone just fine either way.

              Using form.view() as a dialog works great if you don't need to manipulate anything on the form opening, like fetching a specifc record, etc. I usually use form.load() as a dialog because it is more flexible.



              • #8
                RE: Run-away code

                Funny thing should happen.....

                I've been doing something like Greg's and came to the same resolution - that is - opening as 'dialog'. I didn't want to do it that way because we apparently have NO control on WHERE that dialog box will appear on the screen. All of the 'UI' prompts pretty much center themselves on the screen but that 'dialog' form can end up anywhere.

                Is there NO way to do it without opening as a dialog - perhaps have the push set the name of the control as a variable and process an 'If' statement from that? I.E. [Peter Wayne's] var->lstbtn=name.this().

                Does anyone out there share this comsmetic dilemma? And... found a work-a-round?



                • #9
                  RE: Run-away code


                  Jerry: I just re-read your comments and see that you've foud a way to control location of the 'dialog' method for forms.

                  Where can I find documentation on the parameters that you set in your sample. WOW!

                  Ken the 'DUH'....


                  • #10
                    RE: Run-away code


                    Don't feel bad, I stumbled around for a while until I figured how to do that. First, check out the section on ui_info() in the xbasic manual. Next, search this board for ui_info(). There have been a number of discussions about it. As for using it with a dialog, I found that setting a pointer for a form loaded as a dialog allows you to manipulate the form using the pointer. You can change almost any object property using the pointer address. A little experimentation, and the dialog performed as I wanted it. Attached is a little form with a button that I can paste on any form to see exactly what it's size is and it's location. After developement I either hide the button or remove it.



                    • #11
                      RE: Run-away code

                      Thanks Jerry

                      Such a quick response!

                      Thanks alot!