XCodeJock creates an instance of the CJ_TaskPanel() class - look at XCJClass.prg and XCodeJock.Prg for the source.
The font clause creates an object of the XbpFont() class which then converts it to an Automation object by using the ::getIFont() method. This is the only way to set the font in CodeJock. Most of the time this works correctly, but occasionally it locks up.
I am thinking that it may be related to the order of things in the code. I have noticed this in the past. It may be possible to fix
this problem by changing the order in which properties are set.
Look at the below code snippets. I suggest that you play around with the CJ_TaskPanel:create() method in XCJClass.prg.
Change the order in which the font is set by moving the code around a bit. Possibly moving it up or down may make a difference.
Rebuild XCodeJock.Dll by running BUILD19_SL1.BAT.
Also, make sure that you have all the latest hotfixes and that you are running Xbase++ 1.9 (SL1).
Good luck with this.
Code: Select all
CLASS CJ_TaskPanel FROM DC_XbpActiveXControl, CJ_Parts
EXPORTED:
INLINE METHOD Init( oParent, oOwner, aPos, aSize, aPres, lVisible, oGetList )
::clsid := 'CodeJock.TaskPanel' + CJ_Version()
::license := CJ_LicenseControls()
::DC_XbpActiveXControl:init( @oParent, @oOwner, aPos, aSize, aPres, lVisible, oGetList )
AAdd(oGetList:userEvents, { xbeP_User+12345, {|mp1|Eval(mp1)}} )
::CJ_Parts:init()
RETURN self
* ----------
INLINE METHOD Create( oParent, oOwner, aPos, aSize, aPres, lVisible )
LOCAL aGetListItem, aOptions, cFont, cCaption
::DC_XbpActiveXControl:create( @oParent, @oOwner, aPos, aSize, aPres, lVisible )
aGetListItem := ::getList:getListArray[::getListPointer]
aOptions := aGetListItem[xGETLIST_OPTIONS3]
DEFAULT aOptions := {}
ASize(aOptions,21)
DEFAULT aOptions[1] := xtpTaskPanelHighlightDefault, ;
aOptions[2] := xtpTaskItemLayoutDefault, ;
aOptions[3] := xtpTaskPanelThemeNativeWinXP, ;
aOptions[4] := .f., ;
aOptions[5] := xtpTaskPanelAnimationNo, ;
aOptions[6] := xtpTaskPanelBehaviourExplorer, ;
aOptions[7] := xtpBorderNone, ;
aOptions[9] := .f., ;
aOptions[10] := .f., ;
aOptions[11] := .f., ;
aOptions[14] := .f., ;
aOptions[15] := .f., ;
aOptions[16] := .f., ;
aOptions[17] := .f., ;
aOptions[18] := 0, ;
aOptions[19] := 0, ;
aOptions[20] := 0, ;
aOptions[21] := 0
::hotTrackStyle := aOptions[1]
::itemLayout := aOptions[2]
::visualTheme := aOptions[3]
::enableMarkup := aOptions[4]
::animation := aOptions[5]
::behaviour := aOptions[6]
::borderStyle := aOptions[7]
IF Valtype(aOptions[8]) == 'N'
::columnWidth := aOptions[8]
ENDIF
::drawFocusRect := aOptions[9]
::enableAnimation := aOptions[10]
::expandable := aOptions[11]
IF !Empty(aOptions[12])
::setProperty('captionfont',CJ_Font(aOptions[12]))
ENDIF
IF !Empty(aOptions[13])
::setProperty('itemsfont',CJ_Font(aOptions[13]))
ENDIF
::multiColumn := aOptions[14]
::rightToLeft := aOptions[15]
::selectItemOnFocus := aOptions[16]
::singleSelection := aOptions[17]
IF !Empty(aOptions[18]) .AND. !Empty(aOptions[19])
::setIconSize(aOptions[18],aOptions[19])
ENDIF
IF !Empty(aOptions[20]) .AND. !Empty(aOptions[21])
::setGroupIconSize(aOptions[20],aOptions[21])
ENDIF
::subscribeEvent('itemClick', {||::Action(::focusedItem:id)})
::loadedIcons := {}
RETURN self
Code: Select all
FUNCTION CJ_Font( cFont, lIFont )
LOCAL cCompoundName, cFamilyName, nPointSize, oFont, oPS, oIFont
DEFAULT lIFont := .t.
cCompoundName := Alltrim(cFont)
IF 'UNDERSCORE' $ Upper(cCompoundName)
cCompoundName := StrTran(cCompoundName,' UNDERSCORE','')
cCompoundName := StrTran(cCompoundName,' Underscore','')
cCompoundName := StrTran(cCompoundName,' UnderScore','')
cCompoundName := StrTran(cCompoundName,' underscore','')
ENDIF
IF 'BOLD' $ Upper(cCompoundName)
cCompoundName := StrTran(cCompoundName,' BOLD','')
cCompoundName := StrTran(cCompoundName,' Bold','')
cCompoundName := StrTran(cCompoundName,' bold','')
ENDIF
IF 'ITALIC' $ Upper(cCompoundName)
cCompoundName := StrTran(cCompoundName,' ITALIC','')
cCompoundName := StrTran(cCompoundName,' Italic','')
cCompoundName := StrTran(cCompoundName,' italic','')
ENDIF
IF 'SERIF' $ Upper(cCompoundName)
cCompoundName := StrTran(cCompoundName,'MS Sans Serif','Arial')
cCompoundName := StrTran(cCompoundName,'MS Serif','Arial')
ENDIF
cFamilyName := Alltrim(StrTran(CJ_Token(cCompoundName,'.',2),'.',' '))
cFamilyName := StrTran(cFamilyName,' ',' ')
nPointSize := Val(CJ_Token(cCompoundName,'.',1))
oFont := XbpFont():new( oPS ):create(cCompoundName)
oFont:nominalPointSize := Int(nPointSize)
oFont:generic := .t.
IF Upper(cFamilyName) == 'TERMINAL' .AND. !Empty(oPS)
oFont := XbpFont():new( oPS )
oFont:nominalPointSize := nPointSize
oFont:generic := .t.
oFont:fixed := .t.
oFont:familyName := cFamilyName
oFont:create(cCompoundName)
ELSE
oFont:configure(cCompoundName)
ENDIF
IF '.UNDERSCORE' $ Upper(cFont) .OR. ' UNDERSCORE' $ Upper(cFont)
oFont:UnderScore := .t.
ENDIF
IF '.BOLD' $ Upper(cFont) .OR. ' BOLD' $ Upper(cFont)
oFont:bold := .t.
ENDIF
IF '.ITALIC' $ Upper(cFont) .OR. ' ITALIC' $ Upper(cFont)
oFont:italic := .t.
ENDIF
oFont:configure()
IF lIFont
oFont := oFont:getIFont()
ENDIF
RETURN oFont
Class
XbpFont()
Syntax
:getIFont() --> oIFont
Return
This method returns the font as an IFont COM object.
Description
COM/ActiveX components usually manage fonts using COM objects. To assign a font to a property of a COM/ActiveX object, an Xbase++ application often needs to specify the font as an IFont object. The method :getIFont() creates an AutomationObject of class IFont and initializes the object with the font data maintained by the XbpFont instance. The object returned can then be assigned to the COM/ActiveX property.