See Custom Task Panes for more information about Custom Task Panels in PyXLL.
create_ctp
(control, title=None, width=None, height=None, position=CTPDockPositionRight, position_restrict=CTPDockPositionRestrictNone, top=None, left=None, timer_interval=0.1, bridge_cls=None)Creates a Custom Task Pane from a UI control object.
The control object can be any of the following:
Parameters: |
|
---|---|
Returns: |
|
CustomTaskPane
Wrapper around the Excel COM _CustomTaskPane
type.
Returned by create_ctp
.
New in PyXLL 5.5
ContentControl
Gets the Microsoft ActiveX® control instance displayed in the custom task pane frame. Read-only.
DockPosition
Gets or sets a value specifying the docked position of a _CustomTaskPane object. Read/write.
Permitted values are:
CTPDockPositionLeft
CTPDockPositionTop
CTPDockPositionRight
CTPDockPositionBottom
CTPDockPositionFloating
CTPBridgeBase
Base class of bridges between the Python UI toolkits and PyXLL’s Custom Task Panes.
This can be used to add support for UI toolkits other than the standard ones supported by PyXLL.
__init__
(self, control)Construct the custom task pane bridge. The control is the object
passed to create_ctp
.
pre_attach
(self, hwnd)Called before the window is attached to the Custom Task Pane host window.
Optional: Can be overridden in subclass
post_attach
(self, hwnd)Called after the window is attached to the Custom Task Pane host window.
Optional: Can be overridden in subclass
on_close
(self)Called when the Custom Task Pane host window is closed.
Optional: Can be overridden in subclass
on_window_closed
(self)Called when control window received a WM_CLOSE Windows message.
Optional: Can be overridden in subclass
on_window_destroyed
(self)Called when control window received a WM_DESTROY Windows message.
Optional: Can be overridden in subclass
process_message
(self, hwnd, msg, wparam, lparam)Called when the Custom Task Panel host window received a Windows message.
Should return a tuple of (result, handled) where the result is an integer and handled is a bool indicating whether the message has been handled or not. Messages that have been handled will not be passed to the default message handler.
Returning None is equivalent to returning (0, False).
Parameters: |
|
---|
Optional: Can be overridden in subclass
translate_accelerator
(self, hwnd, msg, wparam, lparam, modifier)Called when the Custom Task Panel host control’s TranslateAccelerator Windows method is called.
This can be used to convert key presses into commands or events to pass to the UI toolkit control.
Should return a tuple of (result, handled) where the result is an integer and handled is a bool indicating whether the message has been handled or not. Messages that have been handled will not be passed to the default message handler.
Returning None is equivalent to returning (0, False).
Parameters: |
|
---|
Optional: Can be overridden in subclass
on_timer
(self)If this method is overridden then it will be called periodically and can be used to poll the UI toolkit’s message loop.
The interval between calls can be set by passing timer_interval
to create_ctp
or by setting ctp_timer_interval
in the PYXLL
section of the pyxll.cfg config file.
Optional: Can be overridden in subclass
CTPDockPositionLeft = 0
CTPDockPositionTop = 1
CTPDockPositionRight = 2
CTPDockPositionBottom = 3
CTPDockPositionFloating = 4
CTPDockPositionRestrictNone = 0
CTPDockPositionRestrictNoChange = 1
CTPDockPositionRestrictNoHorizontal = 2
CTPDockPositionRestrictNoVertical = 3