Returning a pointer to the first control in a window, group or menu

first_control()

Return a pointer to the first control in a window, group or menu


SYNTAX

first_control(window_id | group_id | menu_id )

Returns a pointer to the first control in a window, the first control in a textbox group or button group, or to the first menu item in a menu. The first control is the one defined first in the program code. The function returns NULL if the object has no controls. The return value must be assigned to a pointer type temporary field.

The typeof() function can be used to retrieve the type of an object. Object types are defined in the include file $SCULPTOR/include/sculptor.h with the prefix OT_. Possible types for a first control are:

OT_BUTTON

OT_MENUITEM

OT_TEXTBOX

OT_WINDOW

OT_WINGRP

OT_WINTEXT

OT_LISTBOX

OT_TABLE

OT_GRAPHIC

OT_OLE


EXAMPLE

!temp controlptr,,p

     controlptr = &first_control(wintask)

     switch typeof(controlptr) {
          case = OT_BUTTON:
               info "First object is a button"
               break

          case = OT_TEXTBOX:
               info "First object is a textbox"
               break
          ...
     }

RELATED TOPICS

Window objects and controls

first_child()

first_menu()

next_object()

sys.FirstWindow