Home Download Buy Blog Forum Support

Key bindings is no response...help

Key bindings is no response...help

Postby playboysen on Fri Aug 03, 2012 2:50 pm

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: Select all
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)


It can work when I use
Code: Select all
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?

1.jpg
SetWindowTop.py
1.jpg (30.27 KiB) Viewed 693 times


2.jpg
Default (Windows).sublime-keymap
2.jpg (12.32 KiB) Viewed 652 times
Attachments
3.jpg
3.jpg (34.27 KiB) Viewed 646 times
playboysen
 
Posts: 1
Joined: Fri Aug 03, 2012 2:36 pm

Re: Key bindings is no response...help

Postby nick. on Fri Aug 03, 2012 5:02 pm

You seem to have everything setup correctly. Have you tried
Code: Select all
sublime.log_commands(True)
sublime.log_input(True)

to verify your keybindings and command are passing through to Sublime?
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am


Return to Plugin Development

Who is online

Users browsing this forum: Majestic-12 [Bot] and 3 guests