Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Multiple window layouts 2006-05-28 -- Bjarne Havnen Operating two different windows with same fields in the same procedure will
give you a lot of Warning Label Dupliated, but it can be done
The steps are
omit the original window declaration
Declare the window label as a window reference
copy the original window definition and give it another name, like
OriginalWindow
copy it once more and call it CopyWindow
In the embed before opening window, do a reference assignent
Case condition
Of whatever
Window &=Originalwindow
Of another
window &=Copywindow
else
Window &=OriginalWindow
End
If you like to avoid maintaining more than one copy ,make a template to
generate the original code with a copy label based on the
%StandardWindowGeneration. A sample is attached.
#Template(twowin,'make a reference copy of the window'),Family('cw20')
#Extension(twowin,'twowin')
#At(%dataSectionBeforewindow)
Omit('_originalwin')
#EndAT
#At(%dataSectionafterwindow)
_originalwin
%Window &Window
#Insert(%StandardWindowGenerationCopy)
#EndAT
#At(%BeforeWindowOpening)
%Window &=Original%Window
#Embed(%WindowReferenceAssignement,'Overide window refereence')
!condition for openeing do abvoe
#EndAT
#GROUP(%StandardWindowGenerationCopy),AUTO
#MESSAGE('Standard Window Generation',3)
#DECLARE(%NewWindowStatement)
#DECLARE(%CurrentOperationMode)
#IF(%WindowStatement)
#IF(SUB(%WindowStatement,1,11)='APPLICATION')
#SET(%NewWindowStatement,%WindowStatement)
#ELSIF(%WindowOperationMode='Use WINDOW setting')
#SET(%NewWindowStatement,%WindowStatement)
#ELSE
#SET(%CurrentOperationMode,SUB(%WindowStatement,LEN(%WindowStatement)-3,4))
#IF(%CurrentOperationMode = ',MDI')
#IF(%WindowOperationMode = 'MDI')
#SET(%NewWindowStatement,%WindowStatement)
#ELSE
#SET(%NewWindowStatement,SUB(%WindowStatement,1,LEN(%WindowStatement)-4))
#IF(%WindowOperationMode = 'MODAL')
#SET(%NewWindowStatement,%NewWindowStatement & ',MODAL')
#ENDIF
#ENDIF
#ELSIF(%CurrentOperationMode = 'ODAL')
#IF(%WindowOperationMode = 'MODAL')
#SET(%NewWindowStatement,%WindowStatement)
#ELSE
#SET(%NewWindowStatement,SUB(%WindowStatement,1,LEN(%WindowStatement)-6))
#IF(%WindowOperationMode = 'MDI')
#SET(%NewWindowStatement,%NewWindowStatement & ',MDI')
#ENDIF
#ENDIF
#ELSE
#SET(%NewWindowStatement,%WindowStatement)
#IF(%WindowOperationMode = 'MDI')
#SET(%NewWindowStatement,%NewWindowStatement & ',MDI')
#ELSIF(%WindowOperationMode = 'MODAL')
#SET(%NewWindowStatement,%NewWindowStatement & ',MODAL')
#ENDIF
#ENDIF
#ENDIF
#IF(EXTRACT(%WindowStatement,'ICON') AND NOT EXTRACT(%WindowStatement,'IMM'))
#SET(%NewWindowStatement,%NewWindowStatement & ',IMM')
#ELSIF(EXTRACT(%WindowStatement,'MAX') AND NOT EXTRACT(%WindowStatement,'IMM'))
#SET(%NewWindowStatement,%NewWindowStatement & ',IMM')
#ENDIF
Original%Window %NewWindowStatement
#DECLARE(%Indentation,LONG)
#DECLARE(%TestValue)
#SET(%Indentation,0)
#DECLARE(%ControlSourceLine)
#FOR(%Control)
#IF(%ControlIndent<%Indentation)
#LOOP
#SET(%Indentation,%Indentation-1)
%[22+(2*%Indentation)]Null END
#IF(%ControlIndent=%Indentation)
#BREAK
#ENDIF
#ENDLOOP
#ENDIF
#SET(%ControlSourceLine,%ControlStatement)
#IF(%MessageDescription)
#IF(%ControlType <> 'STRING')
#IF(NOT EXTRACT(%ControlStatement,'MSG'))
#FIND(%Field,%ControlUse)
#IF(%FieldDescription)
#SET(%ControlSourceLine,%ControlSourceLine & ',MSG(''' & QUOTE(%FieldDescription) & ''')')
#ENDIF
#ENDIF
#ENDIF
#ENDIF
%[22+(2*%Indentation)]Null %ControlSourceLine
#CASE(%ControlType)
#OF('OPTION')
#OROF('GROUP')
#OROF('SHEET')
#OROF('TAB')
#OROF('OLE')
#OROF('MENU')
#OROF('MENUBAR')
#OROF('TOOLBAR')
#SET(%Indentation,%Indentation+1)
#ELSE
#IF(NOT %FirstField)
#IF(NOT(%ControlMenu OR %ControlTool))
#SET(%FirstField,%Control)
#ENDIF
#ENDIF
#ENDCASE
#ENDFOR
#LOOP,WHILE(%Indentation)
#SET(%Indentation,%Indentation-1)
%[22+(2*%Indentation)]Null END
#ENDLOOP
%[20]Null END
#ENDIF
#IF(NOT(%FirstField))
#SET(%FirstField,1)
#ENDIF
Copy%Window %NewWindowStatement
#Embed(%CopyWindowStatement,'Copy of window content')
End
Today is November 21, 2024, 8:11 am This article has been viewed 35321 times.
|
|