MCPcopy Create free account
hub / github.com/mhammond/pywin32 / OnUpdatePosIndicator

Method OnUpdatePosIndicator

Pythonwin/pywin/framework/app.py:84–100  ·  view source on GitHub ↗
(self, cmdui)

Source from the content-addressed store, hash-verified

82 self.HookCommandUpdate(self.OnUpdatePosIndicator, win32ui.ID_INDICATOR_COLNUM)
83
84 def OnUpdatePosIndicator(self, cmdui):
85 editControl = scriptutils.GetActiveEditControl()
86 value = " " * 5
87 if editControl is not None:
88 try:
89 startChar, endChar = editControl.GetSel()
90 lineNo = editControl.LineFromChar(startChar)
91 colNo = endChar - editControl.LineIndex(lineNo)
92
93 if cmdui.m_nID==win32ui.ID_INDICATOR_LINENUM:
94 value = "%0*d" % (5, lineNo + 1)
95 else:
96 value = "%0*d" % (3, colNo + 1)
97 except win32ui.error:
98 pass
99 cmdui.SetText(value)
100 cmdui.Enable()
101
102 def PreCreateWindow(self, cc):
103 cc = self._obj_.PreCreateWindow(cc)

Callers

nothing calls this directly

Calls 4

GetSelMethod · 0.80
LineFromCharMethod · 0.80
LineIndexMethod · 0.80
SetTextMethod · 0.45

Tested by

no test coverage detected