Use Windows.pkg Use cTextEdit.pkg Use cCJStandardCommandBarSystem.pkg Use cCJCommandBarSystem.pkg Object oImportTextFieldMarkup is a ModalPanel Set Size to 171 429 Set Label to "(autotext)" Set piMinSize to 89 211 Set Location to 9 7 Set Border_Style to Border_Thick Property Boolean pbOk Property String psFilename Property Integer piStart Property Integer piLength Property Boolean pbFirstRowHasFieldNames Property String psName Object oCJCommandBarSystemText is a cCJCommandBarSystem Object oCJStatusBarText is a cCJStatusBar Object oStartPosText is a cCJStatusBarPane Set psText to "Start:" Set pbStyleNoBorders to True End_Object Object oStartpos is a cCJStatusBarPane Set psText to "0" Set piWidth to 40 End_Object Object oEndPosText is a cCJStatusBarPane Set psText to "End:" Set pbStyleNoBorders to True End_Object Object oEndPos is a cCJStatusBarPane Set psText to "0" Set piWidth to 40 End_Object Object oLengthPosText is a cCJStatusBarPane Set psText to "Length:" Set pbStyleNoBorders to True End_Object Object oLengthPos is a cCJStatusBarPane Set psText to "0" Set piWidth to 40 End_Object Object oTextFileStatus is a cCJStatusBarPane Set pbStyleStretch to True Set psText to "(textfile)" Set peAlignment to xtpAlignmentRight Procedure OnCreate String sTextFile Forward Send OnCreate Get psFileName to sTextFile Set psText to sTextFile End_Procedure End_Object End_Object End_Object Object oText is a cTextEdit Set Size to 132 420 Set Location to 5 5 Set psTypeFace to "Consolas" Set piFontSize to 240 Set Read_Only_State to True Set peAnchors to anAll Set pbWrap to False Procedure Add_Focus Handle hoParent Returns Integer String sFilename Integer iStart iLength iLastErrorCode Integer iReturnVal Handle hText Forward Get msg_Add_Focus hoParent to iReturnVal Get psFileName to sFilename Send Read sFilename Get LastErrorCode to iLastErrorCode If (iLastErrorCode = ERR_RE_CANNOT_OPEN_FILE) Begin Send UserError "Cannot open file" End Else Begin Get piStart to iStart Get piLength to iLength Move (iStart - 1) to iStart Send SetSel iStart (iStart + iLength) End End_Procedure Function ReturnSelectedRange Integer ByRef iStart Integer ByRef iLength String ByRef sName Returns Boolean Integer iEnd iLineStart iLineEnd iFirstCharInLine Get SelStart to iStart Get SelEnd to iEnd If (iStart = iEnd) Begin Send UserError "Select a range of text." Function_Return False End Get LineFromChar iStart to iLineStart Get LineFromChar iEnd to iLineEnd If (iLineStart <> iLineEnd) Begin Send UserError "Select a range fom the same line of text." Function_Return False End Move (iEnd - iStart) to iLength Get FirstCharInLinePos iLineStart to iFirstCharInLine Move (iStart - iFirstCharInLine + 1) to iStart If (iLineStart = 0) Begin Get SelText to sName Move (Trim(sName)) to sName End Function_Return True End_Procedure Procedure OnDeltaPos Integer iItem Integer iChange Returns Integer Integer iRetVal Forward Get msg_OnDeltaPos iItem iChange to iRetVal Procedure_Return iRetVal End_Procedure Procedure OnSelectionChanged Integer iStart iEnd iLineStart iLineEnd iFirstCharInStartLine iFirstCharInEndLine Forward Send OnSelectionChanged Get SelStart to iStart Get SelEnd to iEnd Get LineFromChar iStart to iLineStart Get LineFromChar iEnd to iLineEnd If (iLineStart = iLineEnd) Begin Get FirstCharInLinePos iLineStart to iFirstCharInStartLine Get FirstCharInLinePos iLineEnd to iFirstCharInEndLine Move (iStart - iFirstCharInStartLine + 1) to iStart Move (iEnd - iFirstCharInEndLine + 1) to iEnd Set psText of (oStartpos(oCJStatusBarText(oCJCommandBarSystemText))) to iStart Set psText of (oEndPos(oCJStatusBarText(oCJCommandBarSystemText))) to iEnd Set psText of (oLengthPos(oCJStatusBarText(oCJCommandBarSystemText))) to (iEnd - iStart) End Else Begin Set psText of (oStartpos(oCJStatusBarText(oCJCommandBarSystemText))) to "0" Set psText of (oEndPos(oCJStatusBarText(oCJCommandBarSystemText))) to "0" Set psText of (oLengthPos(oCJStatusBarText(oCJCommandBarSystemText))) to "0" End End_Procedure End_Object Object oOK_Btn is a Button Set Label to "&OK" Set Location to 142 320 Set peAnchors To anBottomRight Procedure OnClick Send AcceptRange End_Procedure End_Object Object oCancel_Btn is a Button Set Label to "&Cancel" Set Location to 142 375 Set peAnchors to anBottomRight Procedure OnClick Send Close_Panel End_Procedure End_Object On_Key Key_Alt+Key_O Send KeyAction of oOK_Btn On_Key Key_Alt+Key_C Send KeyAction of oCancel_Btn Procedure AcceptRange Boolean bOk bFirstRowHasFieldNames Integer iStart iLength String sName Get psName to sName Get ReturnSelectedRange of oText (&iStart) (&iLength) (&sName) to bOk If (not(bOk)) Begin Procedure_Return End Set piStart to iStart Set piLength to iLength Get pbFirstRowHasFieldNames to bFirstRowHasFieldNames If bFirstRowHasFieldNames Begin Set psName to sName End Set pbOK to True Send Close_Panel End_Procedure Function MarkupField String sFilename Boolean bFirstRowHasFieldNames Integer ByRef iStart Integer ByRef iLength String ByRef sName Returns Boolean Boolean bOk Set pbOK to False Set psFileName to sFilename Set piStart to iStart Set piLength to iLength Set pbFirstRowHasFieldNames to bFirstRowHasFieldNames Set psName to sName Set Label to (SFormat('Markup text for startposition and size for text column "%1"', sName)) Send Popup Get pbOK to bOk If bOk Begin Get piStart to iStart Get piLength to iLength Get psName to sName End Function_Return bOk End_Function End_Object