Alpha Video Training
Results 1 to 5 of 5

Thread: Set pointer from Form Window Pointer

  1. #1
    Member
    Real Name
    Paul Verboom
    Join Date
    Apr 2006
    Location
    Halifax, Nova Scotia, Canada
    Posts
    144

    Default Set pointer from Form Window Pointer

    Given a Pointer to a form (window). This is typical code generated by the Genies for this;

    WinPtr = obj(":"+object_Name_normalize(word(LayoutName,1,"@")))

    I can get the pointer to the table the form is based on using the following code. This code also returns the most parent table if the form is based on a set

    Tbl = WinPtr.table_get()

    Does anyone know a way to get the Set pointer the Form is based on?

    The set.current() function works in most cases except when the script changes the active form. The set.current() function returns the set that was active when the script was launched as that would be the parent to the script.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Set pointer from Form Window Pointer

    As far as I am aware only objects have parents so there is really no parent to a script. Set.current() returns the set that is active when that line is executed. If you change focus to another form you need to use set.current() again to obtain a pointer to the new/different set.
    There can be only one.

  3. #3
    Member
    Real Name
    Paul Verboom
    Join Date
    Apr 2006
    Location
    Halifax, Nova Scotia, Canada
    Posts
    144

    Default Re: Set pointer from Form Window Pointer

    Thanks for responding Stan much appreciate you taking your time to do so.

    If you don't know an alternative to set.current() I am sure there is none.

    I did code around my problem using the WinPr.table_get() function. I am responding with more details in case anyone else finds this thread.

    Quote Originally Posted by Stan Mathews View Post
    As far as I am aware only objects have parents, so there is really no parent to a script.
    Most likely I am using the wrong terminology here. Scripts launched from forms are in some way dependent on the form that launched them. For example, if you close a form in a script that was launched from the same form, the required statements execute without error but form doesn't close till the script completes. See the following post for more information on this Function to close window(s) run a script or series of commands and the reopen window

    I tried reusing set.curent() after changing focus to another form. Set.current() returned the pointer to the session that was active when the script was launched. In this case, this was for the form that was active when the script was launched. Thinking maybe the UI had not made the 2nd form active before I used Set.current() again, I inserted a XBASIC_WAIT_FOR_IDLE(). Interesting, this function would hang till the timeout value was reached, even more curious, the form would only partially refresh. The title bar would come to the front of the other windows, but the rest of the form would not appear till the script completed.

    I think scripts launched from a form are tied to the session the form is based on. The primary or default session can not be changed till the script has completed. This would explain the behavior I observed.

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,711

    Default Re: Set pointer from Form Window Pointer

    Hi Paul,
    What are you wanting to do with this pointer to the form's set once you get it?
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Set pointer from Form Window Pointer

    Despite the warnings in the documentation I would suggest TABLE.RESET() since you seem to have need for it's functionality. It does accept a set name if you include the .set extension.
    There can be only one.

Similar Threads

  1. How to get pointer to child table from a <form> pointer
    By aschone in forum Alpha Five Version 8
    Replies: 6
    Last Post: 12-07-2007, 05:22 PM
  2. Get Pointer to Unknown Open Form
    By MoGrace in forum Alpha Five Version 6
    Replies: 11
    Last Post: 05-01-2006, 03:59 PM
  3. Form record pointer
    By Peter.Greulich in forum Alpha Five Version 5
    Replies: 3
    Last Post: 10-21-2003, 09:08 AM
  4. Pointer to form's query
    By whanigsberg in forum Alpha Five Version 4
    Replies: 13
    Last Post: 06-23-2002, 12:34 PM
  5. Set pointer to form object
    By Tom Patten in forum Alpha Five Version 4
    Replies: 3
    Last Post: 08-12-2001, 07:05 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
  •