Navigation: Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:Parent ====== | |
Returns the parent control for a control within a structure (such as an OPTION, SHEET or GROUP control structure, or a DETAIL, TOOLBAR, or MENUBAR structure). It can also be used to name a control (e.g., PANEL) as a parent container for other controls.
Example 1:
WinView WINDOW('MyApp'),AT(0,0,320,200),MAX,HVSCROLL,SYSTEM
END
OptionSelected STRING(6)
?OptionControl EQUATE(100) !A field equate number for CREATE to use
?Radio1 EQUATE(101) !A field equate number for CREATE to use
?Radio2 EQUATE(102) !A field equate number for CREATE to use
CODE
OPEN(WinView)
CREATE(?OptionControl,CREATE:option) !Create the OPTION control
?OptionControl{PROP:use} = OptionSelected
?OptionControl{PROP:Text} = 'Pick one'
?OptionControl{PROP:Boxed} = TRUE
SETPOSITION(?OptionControl,10,10)
CREATE(?Radio1,CREATE:radio,?OptionControl) !Create a RADIO control
?Radio1{PROP:Text} = 'First'
SETPOSITION(?Radio1,12,20)
!Create another with same parent:
CREATE(?Radio2,CREATE:radio,?Radio1{PROP:Parent})
?Radio2{PROP:Text} = 'Second'
SETPOSITION(?Radio2,12,30)
UNHIDE(?OptionControl,?Radio2) !Display the new controls
ACCEPT
END
Example 2:
!———————————————————————–
WinParent WINDOW('Caption'),AT(0,0,320,200),SYSTEM,GRAY,MDI
SHEET,AT(x,x,x,x), USE(?Sheet)
TAB('Tab 1'), USE(?Tab1)
PROMPT('Prompt1:'), AT(x,x,x,x), USE(?Prompt1)
ENTRY(@s20), AT(x,x,x,x), USE(Loc.Var)
END
END
BUTTON('Close'),AT(x,x,x,x), USE(?Close)
END
! ?Sheet{Prop:Parent} Belongs to WinParent
! ?Tab1{Prop:Parent} Belongs to ?Sheet
! ?Prompt1{Prop:Parent} Belongs to ?Tab1
! ?Loc:Var{Prop:Parent} Belongs to ?Tab1
! ?Close{Prop:Parent} Belongs to WinParent
Example 3:
!name a control as a parent container for other controls
CASE x{Prop:Type}
OF Create:Button
X{Prop:Parent}=?ImageHorizontal
X{Prop:Ypos}=0
X{Prop:Xpos}=ButtonXpos
X{Prop:Scroll}=True
ButtonXPos+=50
OF Create:Prompt
X{Prop:Parent}=?ImageStatic
X{Prop:Xpos}=PromptXpos !controls are mirrored to the image
X{Prop:Scroll}=True
X{Prop:Follows}=LastControl
LastControl=X
OF Create:Entry OROF Create:Text
X{Prop:Parent}=?ImageStatic
X{Prop:Xpos}=Xpos !controls are mirrored to the image
X{Prop:Scroll}=True
X{Prop:Follows}=Lastcontrol
LastControl=X
END
See Also: