Skip to content

Instantly share code, notes, and snippets.

@cverbiest
Last active August 29, 2015 14:23
Show Gist options
  • Save cverbiest/d0703ce5002a26cb32f0 to your computer and use it in GitHub Desktop.
Save cverbiest/d0703ce5002a26cb32f0 to your computer and use it in GitHub Desktop.
debug listing for OCX library
DEFINE VARIABLE WZ-OCXFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE WZ-Alternate-OCXFile AS CHARACTER no-undo init ?.
/* Version 3 first */
WZ-OCXFile = SEARCH( "xhtml0300.wrx":U ).
WZ-Alternate-OCXFile = SEARCH( "xhtml0200.wrx":U ).
/* Definitions of handles for OCX Containers */
def temp-table T-XSEDITOR no-undo
field TXS-IDENT as char
field TXS-WIDGET AS WIDGET-HANDLE
field PROG-HANDLE as widget-handle
field CFXSEditor AS WIDGET-HANDLE
field chCFXSEditor AS COMPONENT-HANDLE
index T-XSEDITOR1 is unique primary TXS-WIDGET
index T-XSEDITOR2 is unique PROG-HANDLE TXS-IDENT.
/* *************************** Main Block *************************** */
PROCEDURE CFXSEditor.XHTMLEditor.ContentChanged .
/*------------------------------------------------------------------------------
Purpose:
Parameters: None required for OCX.
Notes:
------------------------------------------------------------------------------*/
run FindSelf(buffer T-XSEDITOR).
run RunHandler(buffer T-XSEDITOR, "PreLeave").
T-XSEDITOR.TXS-widget:modified = yes.
END PROCEDURE.
PROCEDURE CFXSEditor.XHTMLEditor.FocusLost .
/*------------------------------------------------------------------------------
Purpose:
Parameters: None required for OCX.
Notes:
------------------------------------------------------------------------------*/
run FindSelf(buffer T-XSEDITOR).
run RunHandler(buffer T-XSEDITOR, "PostLeave").
END PROCEDURE.
PROCEDURE Control_create PRIVATE :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def input parameter I-IDENT as char no-undo.
def input parameter I-WIDGET as handle no-undo.
def output parameter O-CFXSEditor as handle no-undo.
def buffer BT-XSEDITOR for T-XSEDITOR.
if can-find(BT-XSEDITOR where BT-XSEDITOR.TXS-WIDGET = I-WIDGET)
then run xhtml_Destroy(I-WIDGET).
create BT-XSEDITOR.
assign
BT-XSEDITOR.TXS-IDENT = I-IDENT
BT-XSEDITOR.TXS-WIDGET = I-WIDGET
BT-XSEDITOR.PROG-HANDLE = I-WIDGET:instantiating-procedure.
CREATE CONTROL-FRAME BT-XSEDITOR.CFXSEditor
ASSIGN
FRAME = I-WIDGET:frame
ROW = I-WIDGET:row
COLUMN = I-WIDGET:column
HEIGHT = I-WIDGET:height
WIDTH = I-WIDGET:width
/*WIDGET-ID = 2 */
HIDDEN = I-WIDGET:hidden
SENSITIVE = I-WIDGET:sensitive
.
O-CFXSEditor = BT-XSEDITOR.CFXSEditor.
/* DONT DO THIS, the name must match the name of the triggers
BT-XSEDITOR.CFXSEditor:name = subst("CF&1XSEditor", I-IDENT).
*/
BT-XSEDITOR.CFXSEditor:name = subst("CFXSEditor", I-IDENT).
I-WIDGET:hidden = yes.
/* CFXSEditor OCXINFO:CREATE-CONTROL from: {0EED7206-1661-11D7-84A3-00606744831D} type: XHTMLEditor */
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE Control_laden :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def input parameter I-IDENT as char no-undo.
def input parameter I-WIDGET as handle no-undo.
def input parameter I-STYLE as int no-undo.
define output param O-chCFXSEditor as component-handle no-undo.
def buffer BT-XSEDITOR for T-XSEDITOR.
if not can-find(BT-XSEDITOR where BT-XSEDITOR.TXS-WIDGET = I-WIDGET)
then run Control_create(I-IDENT, I-WIDGET).
find BT-XSEDITOR where BT-XSEDITOR.TXS-WIDGET = I-WIDGET.
OCXLOOP:
do while WZ-OCXFile <> ?:
error-status:error = no.
ASSIGN
BT-XSEDITOR.chCFXSEditor = BT-XSEDITOR.CFXSEditor:COM-HANDLE.
BT-XSEDITOR.chCFXSEditor:LoadControls( WZ-OCXFile, "CFXSEditor":U)
no-error.
if error-status:get-number(1) = 5890
then do:
WZ-OCXFile = WZ-Alternate-OCXFile.
WZ-Alternate-OCXFile = ?.
next OCXLOOP.
end.
BT-XSEDITOR.chCFXSEditor = BT-XSEDITOR.chCFXSEditor:XHTMLEditor.
O-chCFXSEditor = BT-XSEDITOR.chCFXSEditor.
run value(subst("SetXStandard&1", entry(1, BT-XSEDITOR.chCFXSEditor:version, ".")))
(BT-XSEDITOR.chCFXSEditor,I-STYLE).
leave OCXLOOP.
END.
if WZ-OCXFile = ?
then MESSAGE "xhtml.wrx":U SKIP(1)
"The binary control file could not be found. The controls cannot be loaded."
VIEW-AS ALERT-BOX TITLE "Controls Not Loaded".
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE DestroyBuffer :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def param buffer BT-XSEDITOR for T-XSEDITOR.
delete object BT-XSEDITOR.CFXSEditor.
delete BT-XSEDITOR.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE FindSelf PRIVATE :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def param buffer BT-XSEDITOR for T-XSEDITOR.
find BT-XSEDITOR where BT-XSEDITOR.CFXSEditor = self no-error.
if not avail BT-XSEDITOR then return error.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE RunHandler PRIVATE :
def param buffer B-T-XSEDITOR for T-XSEDITOR.
def input param I-EVENT as char no-undo.
do on error undo, return error return-value:
I-EVENT = substitute("Trig&1_&2", B-T-XSEDITOR.TXS-IDENT, I-EVENT).
if B-T-XSEDITOR.PROG-HANDLE:get-signature(I-EVENT) <> ""
then run value(I-EVENT) in B-T-XSEDITOR.PROG-HANDLE.
end.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE SetXStandard2 :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def input parameter I-CONTROL as com-handle no-undo.
def input parameter I-STYLE as int no-undo.
I-CONTROL:ToolbarWysiwyg = "ordered-list,unordered-list,draw-layout-table,draw-data-table,layout-table,data-table,strong,underline,strikethrough,cut,copy,paste,undo,find-replace,image,hyperlink,directory,source".
I-CONTROL:EnablePasteMarkup = yes.
I-CONTROL:EnableTimestamp = no.
I-CONTROL:EnableCache = yes.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE SetXStandard3 :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def input parameter I-CONTROL as com-handle no-undo.
def input parameter I-STYLE as int no-undo.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE xhtml_Add :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def input parameter I-IDENT as char no-undo.
def input parameter I-WIDGET as handle no-undo.
def input parameter I-STYLE as int no-undo.
define output param O-CFXSEditor as widget-handle no-undo.
define output param O-chCFXSEditor as component-handle no-undo.
run control_create(I-IDENT, I-WIDGET, output O-CFXSEditor).
run control_laden(I-IDENT, I-WIDGET, I-STYLE, output O-chCFXSEditor).
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE xhtml_Destroy :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def input parameter I-WIDGET as handle no-undo.
def buffer BT-XSEDITOR for T-XSEDITOR.
find BT-XSEDITOR where BT-XSEDITOR.TXS-WIDGET = I-WIDGET no-error.
if avail BT-XSEDITOR
then do:
run DestroyBuffer(buffer BT-XSEDITOR).
end.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
PROCEDURE xhtml_DestroyProcedure :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def input parameter i-proc-hnd as handle no-undo.
def input parameter i-event as char no-undo.
def input parameter i-filehnd as char no-undo.
def buffer DEL-T-XSEDITOR for T-XSEDITOR.
for each DEL-T-XSEDITOR where DEL-T-XSEDITOR.PROG-HANDLE = i-proc-hnd:
run DestroyBuffer(buffer DEL-T-XSEDITOR).
end.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
/* ************************ Function Implementations ***************** */
FUNCTION xhtml_WZ-OCXFile RETURNS CHARACTER
( /* parameter-definitions */ ) :
/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/
RETURN WZ-OCXFile. /* Function return value. */
END FUNCTION.
/* _UIB-CODE-BLOCK-END */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment