Returning the short name of an object

nameof()

Return the short name of an object


SYNTAX

nameof(object_id)

Returns the short name of the object referred to by the identifier object_id - that is to say, the name without any qualifiers. This is of use if object_id is a pointer-type temporary field, or an argument in a call to a user-defined function. Otherwise the function simply returns the value of object_id, which is already known.

This function returns an alphanumeric type.


NOTES

  • The longname() function returns the full, qualified name of an object, including window, group and menu as appropriate.

  • The operator ?= is available to determine if two objects being compared are the same object, which is useful when one of the objects is a pointer field or a function argument.


EXAMPLE

  1. The temp Alpha30 is set to the value “pr.price”

!temp Pointer,,p
!temp Alpha30,,a30

     tmp.Pointer = &pr.price
     tmp.Alpha30 = nameof(tmp.Pointer)
  1. Store name of selected tab:

    !temp CurrentTab,,a100
    
    +window winTabContainer at 0, 35 {
         max_width = 320
         max_height = 355
         parent = wintask
         style = WS_TABCONTROL
         event = TabWinEvent
    }
    
    !function TabWinEvent(EventCode, Window, Tab) {
         if (EventCode = EV_SELECT_TAB) {
              CurrentTab = nameof(Tab)
            }
        }
        return
    }
    

RELATED TOPICS

longname()

parent()

fromname()