Function Example
In this example several other functions are called. The Start_Window() function is used with the GetStructureFlag$ equate; user-defined properties are used in the Get_Property() and Set_Property() functions; different title and instance default parameters are used; and the Start_MDIChild() function is called. As a final process, the status code is checked to see if the function executed successfully. If not, a debug statement was used to start the Debugger.
Compile Function Create_MDIChild(WinID, FrameID, CMDLine, Title, Mode) Begin Condition Pre: Post: End Condition Declare Function Start_MDIChild, Get_Status, Get_Property, Set_Property, Start_Window $INSERT logical $INSERT ps_equates Equ WindowDef$ TO 1 Equ GetStructureFlag$ TO 1 InstanceID = Get_Property( FrameID, '@' : WinID : '* INST' ) + 1 Stat = Set_Property( FrameID, '@' : WinID : '* INST', InstanceID ) If Not( assigned( CMDLine ) ) Then CMDline = '' If Not( assigned( Mode ) ) Then Mode = False$ If Not( assigned( Title ) ) Then WinStruct = Start_Window( WinID, '', '', True$ ) Title = Winstruct<WindowDef$, Pspos_Text$> Title := '<' : InstanceID : '>' End WinName = Start_MDIChild(WinID, FrameID, CMDLine, InstanceID, Title, Mode) If Get_Status( Stat_Code ) Then Debug Return WinName