Alpha Video Training
Results 1 to 3 of 3

Thread: Need Help with Table Pointer

  1. #1
    Member
    Real Name
    Bill Campbell
    Join Date
    Feb 2001
    Posts
    13

    Default Getting Table Pointer to New Form in Same Set

    I am trying to open a new form in the same set, while maintaining the current record and order. Essentially, a toggle between forms but with different window dimensions.

    I have tried various methods, but the simplest seems to be to define a global variable N with TBL. logicalrecord_get() on the first form, open the second form, and set the current record with TBL.logicalrecord_set(N).

    This method works if I put the TBL.logicalrecord_Set() on the OnActivate event of the second form, but I'm trying to create a global script that I can attach to a toolbar.

    What happens now is that the TBL.logicalrecord_set() is operating on the first form, not the second. If I close the first form before opening the second, it still doesn't work. The TBL pointer seems to stay with the primary table in the first form.

    I guess my question is how do I get a pointer to the primary table in the second form so that the TBL.logicalrecord_set() works.

    Or, if there's a better way to toggle to another form, please tell me how.

    Below is my current script, which is 3 Action Script steps converted to Xbasic:

    Code:
    Step 1
    'Execute inline Xbasic code.
    dim tbl as P
    dim global n as n
    tbl = table.current()
    n = tbl.LogicalRecord_Get()
    form.Close()
    
    Step 2
    'Open a Form or Browse layout, displaying all, or selected records in the layout.
    
    DIM Shared varP_PullBrowse as P
    DIM layout_name as c 
    layout_name = "PullBrowse"
    DIM tempP as p
    'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
    tempP=obj(":"+object_Name_normalize(word(layout_name,1,"@")))
    'Test if pointer is valid
    if is_object(tempP) then 
    	'Test if pointer refers to a form or browse
    	if tempP.class() = "form" .or. tempP.class() = "browse" then 
    		'If so, then activate the already open window
    		tempP.activate()
    		
    	else
    		'Window is not already open, so open it
    		varP_PullBrowse = :Form.view(layout_name)
    		
    
    	end if
    else 
    	varP_PullBrowse = :Form.view(layout_name)
    	
    
    end if
    
    Step 3
    'Execute inline Xbasic code.
    tbl.logicalrecord_set(n)
    parentform.Resynch()
    Thanks
    Last edited by BillCampbell; 12-15-2005 at 11:43 PM.

  2. #2
    "Certified" Alphaholic
    Real Name
    jim chapman
    Join Date
    Apr 2000
    Posts
    1,779

    Default

    Hello Bill,

    >>I guess my question is how do I get a pointer to the primary table in the second form so that the TBL.logicalrecord_set() works.<<

    I don't understand why you are using the *.logicalrecord_get() and set() methods. Honestly I have never used them. I don't understand why you'd need to logical position in the second form anyway. Here's how I'd do it:

    Code:
    vRecord = table.get("PrimaryTableName").recno()
    
    vForm = form.load("SecondFormName")
    
    vForm.recno_goto(vRecord)
    vForm.show()
    vForm.activate()
    If you want the second form to be in the same order as the first form, just make sure that the same index or query is set for the second form.

    You'd need to deal with navigations issues with the second form if you didn't want the user to be able to navigate away from the record.

    But I may not be understanding what you are wanting to do with the logical record.

    Good luck,
    Jim
    Last edited by Jim Chapman; 12-16-2005 at 12:31 AM.

  3. #3
    Member
    Real Name
    Bill Campbell
    Join Date
    Feb 2001
    Posts
    13

    Default

    Thanks. That works great. I was obviously making it much more difficult than necessary. I just assumed that if it searched by record number it would change the order on the called form to record number order.

    I should have asked for help two (long) days ago.

Similar Threads

  1. Error with table pointer
    By martin horzempa in forum Web Application Server v7
    Replies: 10
    Last Post: 12-04-2006, 01:01 PM
  2. Table Pointer error
    By Wanda Tucker in forum Web Application Server v6
    Replies: 0
    Last Post: 05-26-2005, 04:27 PM
  3. Can I get a pointer to a A5 function?
    By Marcel Kollenaar in forum Alpha Five Version 6
    Replies: 0
    Last Post: 07-26-2004, 02:05 AM
  4. Field pointer?
    By Jeff Moses in forum Alpha Five Version 4
    Replies: 3
    Last Post: 10-11-2001, 03:42 AM
  5. v4.5 closing form an error getting table pointer
    By Jim Chapman in forum Alpha Five Version 4
    Replies: 4
    Last Post: 02-16-2001, 09:40 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
  •