I added a button to my routine in Code Editor, but how to make it not duplicate when compiling the plugin?
With two lines of code, I improvised and it works fine:
Código: Seleccionar todo
function install_ColorPicker(self)
local oBand
AEval( ::IEditor:oRebar:aItems, {|o|IF(HB_IsChar(o:cargo) .and. o:cargo == UTIL_NAME, o:oControl:end(), /*NIL*/)} ) // improvisation. it works and it doesn't blink.
//AEval( ::IEditor:oRebar:aItems, {|o|IF(HB_IsChar(o:cargo) .and. o:cargo == UTIL_NAME, o:free(), )} ) // does not work.
oBand:=::IEditor:oRebar:addItem()
oBand:cargo:=UTIL_NAME // improvisation
::addUtility( UTIL_NAME )
WITH OBJECT TToolBar():New( ::IEditor:oRebar )
:Create()
:AddButton( "", "clrpicker",,, 'Color Picker'):onClick:={|| dlgColorPicker(self) }
END
return nil
Código: Seleccionar todo
function install_ColorPicker(self)
local oBand
oBand:=::IEditor:oRebar:addItem()
::addUtility( UTIL_NAME )
WITH OBJECT TToolBar():New( ::IEditor:oRebar )
:Create()
:AddButton( "", "clrpicker",,, 'Color Picker'):onClick:={|| dlgColorPicker(self) }
END
::addEnd(oBand:oControl) // for UnRegister to destroy
//::addEnd(oBand) // does not work.
return nil
METHOD addEnd( o ) CLASS MCPlugin
if HB_IsObject(o)
AAdd(::aEndList, o)
endif
return nil
METHOD unRegister() CLASS MCPlugin
local nPos
for nPos:=1 TO Len(::aEndList)
TRY
//::aEndList[nPos]:free()
::aEndList[nPos]:end()
::aEndList[nPos]:=nil
END
next
::aEndList:={}
return ::Super:unRegister()