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

Not an Executable/Bad Object Handle

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

    Not an Executable/Bad Object Handle

    Grrr - another productivity killer.

    A5V5 Latest Version

    I have a Modal Maintenance Form that is called from another Form - the below happens whether I open it from another form (or just run it off the Forms menu).

    If I place this code in the OnInit event of the called Form:

    topparent:Field1.value = ws_athleteid
    t3=table.open("athletes")
    t3.fetch_first()
    query.filter = "At_id=var->ws_athleteid"
    qry_meetings = t3.query_create()
    nrecs=qry_meetings.records_get()
    topparent:ws_athlete.value=t3.At_surname+t3.At_firstname
    t3.close()

    Then I get a "bad object handle" message and then the Form opens (with my athlete name loaded). If I comment out the Oninit code:

    'topparent:Field1.value = ws_athleteid
    't3=table.open("athletes")
    't3.fetch_first()
    'query.filter = "At_id=var->ws_athleteid"
    'qry_meetings = t3.query_create()
    'nrecs=qry_meetings.records_get()
    'topparent:ws_athlete.value=t3.At_surname+t3.At_firstname
    't3.close()

    I get a "not an executable file" - but then opens my Form - go figure...

    ws_athleteid is a global variable set in my calling Form. ws_athlete is a variable defined in the called Form using the A5 variable define facility in the Form/variable pop-down menu.

    If I remove all code completly from the OnInit event then the Form opens fine from menu and from my calling Form.

    Now here's the catch, I have another Form that I call from the same Form, I have the same Init event code and it works a treat - the only difference being that I open the called Form in new record mode (this.new_record()).

    this.new_record()
    topparent:Field1.value = ws_athleteid
    t3=table.open("athletes")
    t3.fetch_first()
    query.filter = "At_id=var->ws_athleteid"
    qry_meetings = t3.query_create()
    nrecs=qry_meetings.records_get()
    topparent:ws_athlete.value=t3.At_surname+t3.At_firstname
    t3.close()

    Both called Forms are Modal, both called Forms maintain the same data (in fact one Form was duplicated form the other).

    A5 offers no useful error info - nor does debug help solve the issue. Is it a problem with my code or an A5 issue? Has anyone come across the same issue - and found a solution..

    I have noticed prior postings regarding similar errors - but I find the above inexplicable..

    Regards,
    Scott

    Ps

    Here's the code that decides which Form to call:

    DIM GLOBAL ws_athleteid AS n
    DIM nrecs as n
    DIM Shared varP_Mnt_athleteprofilenew as P
    DIM Shared varP_Mnt_athleteprofile as P
    DIM layout_name as c
    'Get 'Value' property of 'Athleteid' in Form 'mnt_athletes' .
    DIM GLOBAL ws_athleteid AS n
    ws_athleteid = topparent:Athleteid.value
    t3=table.open("athleteprofile")
    t3.fetch_first()
    query.filter = "Ap_athleteid=var->ws_athleteid"
    qry_meetings = t3.query_create()
    nrecs=qry_meetings.records_get()
    t3.close()
    If nrecs=0 then
    layout_name = "Mnt_athleteprofilenew"
    varP_Mnt_athleteprofilenew = :Form.view(layout_name,"dialog")
    if is_object(varP_Mnt_athleteprofilenew) = .t. then
    varP_Mnt_athleteprofilenew.close()
    end if
    end if
    If nrecs>0 then
    layout_name = "Mnt_athleteprofile"
    varP_Mnt_athleteprofile = :Form.view(layout_name,"dialog")
    if is_object(varP_Mnt_athleteprofile) = .t. then varP_Mnt_athleteprofile.close()
    end if
    end if





    #2
    RE: Not an Executable/Bad Object Handle

    I have now copied the called Form that does work to a new Form, added the this.new_record() line in the OnInit code and it works. Then I noticed an additonal difference - the version that won't work has a Filter defined (via the Form Properties and devised using the pick and click routine provided in A5) - Ap_athleteid = Var->ws_athleteid

    As you will see, ws_athleteid is a GLOBAL variable defined in the calling Form. Is the filter not valid, did A5 allow the injection of code via it's tools that was not correct?, or is it not executing the code correctly when running it, or have I stuffed up somewhere else?

    If I remove the Filter, the Form can be called without error and for some reason it loads the correct record that I am looking for - but no filter is defined to ask for that record to be found.. The calling Form maintains an Athlete Record and the Called form maintains an athlete profile record - not defined in a set. I must be missing something here.. can anyone shed some light before I pull all of my hair out?

    Regards,
    Scott



    Comment


      #3
      RE: Not an Executable/Bad Object Handle

      Oop's- I mean removed the this.new_record() line - not added.

      Comment


        #4
        RE: Not an Executable/Bad Object Handle

        Scott,
        I can't spot the difficulty in your script, but have you traced the action with the debugger. Using debugger you could track the assignment of variables and action of the script one step at a time and possibly find the spot where it fails.

        Comment


          #5
          RE: Not an Executable/Bad Object Handle

          Scott,

          Two things I'd try:

          topparent:Field1.value = ws_athleteid
          could be changed to
          this:Field1.value = var->ws_athleteid

          The onInit event is running at the form level. You're
          trying to modify an object value on the current form,
          right ? What does 'topparent' mean to the current form ?

          The 'Var->' prefix may be surplusage, but I think it's a
          good practice.


          topparent:ws_athlete.value=t3.At_surname+t3.At_firstname
          could be changed to
          this:ws_athlete.value=t3.At_surname+t3.At_firstname

          For the same reasons.

          -- tom

          Comment


            #6
            RE: Not an Executable/Bad Object Handle



            Also, when you comment out an entire script with the apostraphe before each line, you will get that error message every time. If you want to stop an event code from running, so that you can see if it causes whatever wrror, then use an 'end' statement at the top of your script.

            Gary
            Gary S. Traub, Ph.D.

            Comment


              #7
              RE: Not an Executable/Bad Object Handle

              thanks - hopefully one day that 'bug' will be fixed.

              Comment


                #8
                RE: Not an Executable/Bad Object Handle

                Hi Tom

                Thanks for your input - you seem to be a tireless contributor to this forum!

                Using 'this' instead of 'topparent' fixes the issue. I used the script Genie to get the code which is where the topparent came from - being fairly new at A5 I did not know any better than what it generated for me. May be I selected an incorrect option in the script Genie or maybe it did not return the best practise code - I will have to investigate some more.

                Regards,
                Scott

                Comment


                  #9
                  RE: Not an Executable/Bad Object Handle

                  Scott, review the 'object addressing' sections of the Xbasic Reference Manual. You'll find an orderly system for referencing objects absolutely (by name), or indirectly by reference to the 'current' context.

                  topparent
                  parent
                  parentform

                  these are all examples of indirect references, and often used in scripts run from buttons. The button's OnPush event is the 'current' context. If your button's OnPush event used the term 'this' it would reference the button itself. See the diff ?

                  -- tom

                  Comment


                    #10
                    RE: Not an Executable/Bad Object Handle

                    k - I get it now - thanks. Importantly, it would seem that I must also remember not to take the Genie created code for granted - it will not neccessarily 'throw up' the correct code - a trap for young players..

                    Comment


                      #11
                      RE: Not an Executable/Bad Object Handle

                      I'm so glad you had this thread here! I've been struggling for hours with this same ____ problem and your banter moved my thinking in a new direction. I was already searching on my called form's OnInit, but it turns out one tiny piece of my genie-generated code doesn't work correctly in my form's OnInit, but it DOES work just fine in the same form's OnActivate with no other changes. Maybe I will sleep tonight :-) Bless the message groups and all who contribute (I promise to contribute more when I know what I'm talking about!)

                      Comment


                        #12
                        RE: Not an Executable/Bad Object Handle

                        Kellen,

                        It would be helpful to the 'next guy' if you would post the details describing which piece of the genie based script wouldn't work in the OnInit of your form.

                        -- tom

                        Comment


                          #13
                          RE: Not an Executable/Bad Object Handle

                          Good idea Tom...FYI to anyone interested in this topic...

                          I have a form to enter misc daily notes for a gas station (ie weather; competitor prices, etc). Only ONE record is wanted per day, so I want a NEW record if there isn't one yet for the day, or to EDIT the record if one exists already. I do this by setting a global C variable "entry_type" in the launching form to "new" or "edit" depending on whether a record exists in the target table for the appropriate effective_date. The actual data entry form is then initialed based on the value in var->extry_type.

                          The genie code that did NOT work in the OnInit event when var->entry_type="edit" is "Set Field Values", changing the value in Emp_id (employee_id field) to the value in var->login_id (which holds the emp_id of the currently logged in user). Interestingly, this same code works fine since I moved it (unchanged) to the onActivate event.

                          FYI, a conversion to inline xbasic code shows the genie code as generating "topparent:Emp_id.value=login_id". Looks fine to me, but I still have a lot to learn).

                          Comment

                          Working...
                          X