Sublime Forum

Key bindings is no response...help

#1

I have some troubles when tring to develop some plugin.
I want to set SublimeText’s main window to topmost using API SetWindowPos,and my code is:

[code]import sublime, sublime_plugin
from ctypes import *

user32 = windll.user32
classname = “PX_WINDOW_CLASS”
hWin = user32.FindWindowA(classname,None)

class SetWindowTopCommand(sublime_plugin.TextCommand):
def run(self, view):
user32.SetWindowPos(hWin,-1,0,0,0,0,3)[/code]

It can work when I use view.run_command("set_window_top") in the console window,but when I create Default (Windows).sublime-keymap to bind some hot key to my plugin,it seems no response.

It is strange that the hot key can work when I open and save SetWindowTop.py again without any changes.
I need some help to know why,please?





0 Likes

#2

You seem to have everything setup correctly. Have you tried

sublime.log_commands(True) sublime.log_input(True)
to verify your keybindings and command are passing through to Sublime?

0 Likes