Alpha Video Training
Results 1 to 2 of 2

Thread: Forms: get name

  1. #1
    "Certified" Alphaholic
    Real Name
    Richard Coleman
    Join Date
    Oct 2000
    Location
    Franklin, TN
    Posts
    1,206

    Default Forms: get name

    <OBJECT>.GETACTIVEOBJPARENT()
    Syntax
    Pointer Container_Object = <OBJECT>.GETACTIVEOBJPARENT()
    Description
    The <OBJECT>.GETACTIVEOBJPARENT() method applies to:
    Browses (for <OBJECT> use either the <BROWSE> pointer or the name of the browse)
    Forms (for <OBJECT> use either the <FORM> pointer or the name of the form)
    The <OBJECT>.GETACTIVEOBJPARENT() returns a pointer to the container of the object that has focus.

    Example
    The following script returns the name of the form

    ---script should be here??

    See Also
    Form Functions and Methods, Browse Functions and Methods
    Supported By
    Alpha Five Version 5 and Above
    The above is right from the chm. You will note that the actual script is missing and I cannot find anything under <object> or
    <form> to accomplish that task.
    I need a generic script that can be run from 9 different forms and I need to be able to pass the form name to the script.
    Any help ........ you know!
    D

  2. #2
    "Certified" Alphaholic
    Real Name
    Richard Coleman
    Join Date
    Oct 2000
    Location
    Franklin, TN
    Posts
    1,206

    Default

    The following code seems to work just fine. did alot of experimenting to get the form name to print in a msg box.
    Have only done it on one form, but since the name of the form comes out right, it should work anywhere.
    This script runs conditionally based on more than 1 record.
    D

    Code:
    'check # recs
    recs_this=topparent.records_get() ' need a 'recs_this' variable on every form
    
    'This script deletes the current record.
    dim tbl as P
    DIM SHARED  delwarn_result as N
    DIM SHARED  delwarn_OK_Button as L
    dim shared  recs_this as n
    
    if recs_this<2 then
    	'Displays a message box (style:'OK Button', image: 'Stop symbol', id: 'del_warn').	 
    	delwarn_OK_Button = .F.
    	title_var = "DELETION ABORTED!"
    	message_text_var = <<%text%
    You cannot delete the last record.
    Either edit this record, or add more
    records and then delete this record.
    %text%
    	delwarn_result=ui_msg_box(title_var,message_text_var,UI_OK+ UI_FIRST_BUTTON_DEFAULT+ UI_STOP_SYMBOL)
    	'Test to see which button on the message box was pressed....
    	SELECT
    		CASE delwarn_result = UI_OK_SELECTED
    			delwarn_OK_Button= .t.
    	END SELECT	 
    	goto the_end
    else
    	tbl = table.current()
    	tbl.change_begin()
    	tbl.delete()
    	tbl.change_end(.T.)
    end if
    
    the_end:
    
    DIM object_name as C
    object_name = ":"+topparent.Name()
    DIM varP_Object as p
    'Get a pointer to the specified object
    varP_Object = obj(object_name)
    'Check if the specified object exists
    if .not. is_object(varP_Object) then 
    	ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
    else
    	varP_Object.QuickSortExplicit("Song_category","Ascending")
    end if
    
    recs_this=varP_Object.records_get()
    
    end

Similar Threads

  1. Forms
    By bmann3 in forum Alpha Five Version 6
    Replies: 1
    Last Post: 08-31-2005, 05:25 PM
  2. Help with forms
    By jarty67 in forum Alpha Five Version 6
    Replies: 8
    Last Post: 11-06-2004, 04:50 AM
  3. Using forms
    By Nkiru Ikechukwu in forum Alpha Five Version 5
    Replies: 2
    Last Post: 10-18-2004, 05:43 AM
  4. sub forms & transferring forms
    By Carrie McIver-Herndon in forum Alpha Five Version 5
    Replies: 3
    Last Post: 05-14-2003, 01:00 PM
  5. forms
    By Ron Morgan in forum Alpha Five Version 4
    Replies: 1
    Last Post: 06-13-2000, 08:01 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
  •