Returning a pointer to the next object at the same levelΒΆ

next_object()

Return a pointer to the next object at the same level


SYNTAX

next_object(objectptr)

Returns a pointer to the next object at the same level, or NULL if there are no more objects at the same level.

The next object is determined by the value of objectptr, which may itself point to any of the following:

Menu

The next object is the next menu defined in the same window.

Menu item

The next object is the next menu item defined in the same menu.

Child window

The next object is the next child window defined in the same window.

Window control or group

The next object is the next window control or group (button group or textbox group) defined in the same window at the same level. Note that if objectptr points to a group, the next object is not a control inside the group. See the example below.


EXAMPLE

this example steps through all the controls in a window, including those within groups:

!temp pcontrol,,p
!temp pingroup,,p


     pcontrol = &first_control(WinMain)
     while (isnull(pcontrol) == FALSE) {
          switch (typeof(pcontrol)) {
          case == OT_BUTTON:
               break
          case == OT_TEXTBOX:
               break
          case == OT_LISTBOX:
               break
          case == OT_OLE:
               break
          case == OT_TABLE:
               break
          case == OT_GRAPHIC:
               break
          case == OT_WINTEXT:
               break
          case == OT_WINGRP:
               pingroup = &first_control(pcontrol)
               while (isnull(pingroup) == FALSE) {
                    pingroup = &next_object(pingroup)
                    switch (typeof(pingroup)) {
                         case == OT_BUTTON:
                              break
                         case == OT_TEXTBOX:
                              break
                    }
               }
               break
          }

          pcontrol = &next_object(pcontrol)
     }

RELATED TOPICS

Window objects and controls

Hierarchy of windows

first_child()

first_control()

first_menu()

sys.FirstWindow