Alpha Video Training
Results 1 to 15 of 15

Thread: BAD OBJECT HANDLE

  1. #1
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default BAD OBJECT HANDLE

    Have a "Menu" form that allows two different data entry forms be used.

    An On-Init event for the "Menu" dimensions a GLOBAL object pointer (frm1, and frm2)for each of the two data entry forms.

    The "Menu" has a button for each of the two data entry forms. Each button has an on-push event that has the following code where the 9 is either a 1 for frm1 or a 2 for frm2.
    If is_object (frm9) then
    frm9.show()
    frm9.activate()
    else
    frm9=form.view("FORM9")
    endif

    When the on-push event runs to load FORM1, I get the "BAD OBJECT HANDLE" when the on-push event runs to load FORM2, it runs without error.

    I have the latest version of A5 running on one pc, this is the version that has the BAD OBJECT HANDLE. On another pc, I have the first unpatched version of A5v5 and it will allow either form to load WITHOUT the BAD OBJECT HANDLE.

    What give with this?

    Thanks
    Barry Shadduck

  2. #2
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default RE: BAD OBJECT HANDLE

    So I said to myself, what gives with this?

    Forms behave one way with old version, and another way with new version. Each behaviour has it's good and bad traits,
    so I guess I decide which of two evil's is lesser, and live with (or more likely, die with) it???????

  3. #3
    Thomas Henkel
    Guest

    Default RE: BAD OBJECT HANDLE

    Why arent you using action scripting?? The action script will produce the code for you. I have always written native xbasic, but I have been shown just how powerful action scripting really is. Give it a try.

    Tom

  4. #4
    Thomas Henkel
    Guest

    Default RE: BAD OBJECT HANDLE

    Just a question... Should it be FORM.VIEW("FORM1") or FORM.VIEW("fmr1")???

    I nearly ripped what's left of my hair out yesterday only to find that I had placed an underscore"_" where a space " " should have been.

  5. #5
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default RE: BAD OBJECT HANDLE

    Thanks for your reply. frm1 points to whatever I call the form and in the example it is "FORM1".

  6. #6
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default RE: BAD OBJECT HANDLE

    Thanks for your reply, but what is action scripting?

    And why does the same very simple code fragment work for one button, but not the other? This is the kind of stuff that drives me up the wall, down the street, and into the nearest saloon, pub, or other beer quafing place.

    Makes no $#*%%ing sense at all. Very very very very hard to debug such inconsistant junk.

  7. #7
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: BAD OBJECT HANDLE

    Barry,

    Is it possible you're looking in the wrong place?

    Perhaps there's an error that's occurring in the OnInit or OnActivate events in the called form.

    Do the onPush event scripts in your Menu form's buttons do anything else besides what you've shown us?

    -- tom

  8. #8
    Member Mario Prieto's Avatar
    Real Name
    Mario Prieto
    Join Date
    Apr 2000
    Location
    Las Cruces, NM
    Posts
    364

    Default RE: BAD OBJECT HANDLE

    Very weird, but if you post your code for the menu form maybe there may be something there that your eyes are not finding, and give a chance for more eyes to inspect it.



    Mario
    The Mexican

  9. #9
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default RE: BAD OBJECT HANDLE

    Thanks for your reply,

    Found that a "this.newrecord()" statement that works fine
    in the unpatched v5.0, generates a bad object handle in the latest patched version.

    So I will stumble along some more and see how far I can go before I fall down again.

  10. #10
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default RE: BAD OBJECT HANDLE

    Thanks Mario, before I am finished with this little app,
    (been working on it on and off from version 4.5 to present version, for two years or so), I may need to post the app as you suggested.

    Thanks for your reply.

  11. #11
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default RE: BAD OBJECT HANDLE

    Hello Tom,

    Yes the error does occur in the OnInit of the called form in the updated A5 version, however in the non-updated version, the code works just fine.

    What I am trying to do is use the recommended object pointers. A menu form checks for an existing object (is_object), and when not found, assigns the form name to the object.

    Then, the ON-INIT event of the called form uses a .new_record()function to put the non-menu form into data entry mode. This is where I get the BAD OBJECT HANDLE in the updated A5 version (no matter how I address the .new_record() function). The old version will let me use absolute addressing for the function, but not an object pointer.

    Is there a standard way to do this, and my method is not one of them? Is there any documentation on working with forms using xbasic other than the chapter on XBASIC METHODS FOR OPENING FORMS AND BROWSES? If not there should be in my opinion, as there is much more to using forms than opening them.

    My frustration level is getting very high at this point, I am hoping that I do not have to download some sample database, and study it to get my stuff to work. I like to use documentation to find my way, but that requires documentation that is comprehensive, and accurate.

    Thanks

  12. #12
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: BAD OBJECT HANDLE

    Barry,

    It's difficult to troubleshoot your forms when they haven't been posted.

    In the onInit event script for the called form, use THIS to reference the form itself.

    THIS.new_record()

    If you're using a reference to a pointer for the form defined in the CALLING form, the variable scope for the pointer is probably wrong. Unless you declared the pointer variable global in the calling form, it's local, and the called form (and it's onInit script) can't see it.

    In my own work I don't use the OnInit event of the CALLED form to begin the new record. I let the OnPUsh button script from the calling form do it.

    I check to see if the form is already open.
    If it's open the OnPush script checks it's mode.
    If it's VIEW then the same script begins the new record.
    If it's not VIEW then I warn the user.
    If it's not an open form, I LOAD it.
    I set the desired index.
    I begin the new record.
    I show the called form.
    I activate the called form.

    -- tom

  13. #13
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default RE: BAD OBJECT HANDLE

    Thanks Tom,

    I do use GLOBAL object pointers. Since the documentation is getting me nowhere, if you could paste one of your ON-PUSH events into a reply, I'm sure it would be very helpful to me.

    By the way, was using this.new_record() and it was ok for old A5, but not for the new A5. At any rate I will take your advice, and remove code from oninit event of called form. Had it there because I was able to make it work there before I installed new version.

    Thanks

  14. #14
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: BAD OBJECT HANDLE

    Barry, unzip the attachment to an empty folder.

    The example database I've attached illustrates several different ways to open a new form and pass values to a new record begun there.

    I suggest you study the option to

    Manipulate Objects on the Called Form

    that you'll find on the Main menu.

    This illustrates how to do it from the calling form, using absolute addresses in the one case, and object pointers in the second.

    Hope you find this useful, it's an adaption of stuff I've posted in the code archive long ago.

    -- tom

  15. #15
    Member
    Real Name
    Barry Shadduck
    Join Date
    Jul 2001
    Location
    Lansing Michigan
    Posts
    181

    Default RE: BAD OBJECT HANDLE

    Thanks, it did help. At least I got rid of the bad object handle, will attribute the success to using form.load() instead of form.view().

    Now I need to recind my previous comment on documentation, as I see there is a small chapter on Xbasic Methods for Working with Forms and Browses.

Similar Threads

  1. Bad Object Handle
    By Brandon Burtnik in forum Alpha Five Version 5
    Replies: 2
    Last Post: 08-18-2005, 01:56 PM
  2. Bad Object Handle
    By Mike Vance in forum Alpha Five Version 6
    Replies: 29
    Last Post: 07-06-2005, 07:12 AM
  3. Bad Object Handle
    By Zod Mansour in forum Alpha Five Version 6
    Replies: 5
    Last Post: 09-17-2004, 08:54 AM
  4. bad object handle
    By EYoo in forum Alpha Five Version 4
    Replies: 2
    Last Post: 05-30-2003, 03:04 PM
  5. bad object handle
    By Madelene Ferguson Allen in forum Alpha Five Version 1
    Replies: 2
    Last Post: 07-26-2000, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •