[PythonCE] One other question: detecting SIP

Progor dpwhittaker at gmail.com
Wed Feb 28 15:39:55 CET 2007


Ah, thanks, you got me pointed in the right direction anyway.  I'm using
Tkinter, and as far as I can tell it's protocol method doesn't give you
access to the param's, but with this pointer in the direction of API calls I
was able to:

1. Allocate a SIPINFO structure.
2. Set up a polling loop that calls GetSipInfo
3. Manually resize my main frame if anything in rcVisibleDesktop changes.

I'm really just looking at rcVisibleDesktop.bottom right now, but I'm going
to buff it up a bit and check the rest of the parameters as well, soon, in
order to better accomodate different orientations and hi-res devices.  One
thing I did notice was that when the SIP is up, the bottom parameter gives
you the top of the SIP... which is great, but when the SIP is down, it gives
you the bottom of the menu bar, so right now it looks like I have to special
case it to accomodate hi-res devices and still leave room for a menu bar at
the bottom.  I'll figure it all out and post a nice, elegant solution in
Tkinter pretty soon, I hope.


Luke Dunstan wrote:
> 
> 
> ----- Original Message ----- 
> From: "Progor" <dpwhittaker at gmail.com>
> To: <pythonce at python.org>
> Sent: Tuesday, February 27, 2007 2:15 PM
> Subject: [PythonCE] One other question: detecting SIP
> 
> 
>>
>> Is it possible to detect whether the SIP (software keyboard) is displayed 
>> or
>> not?  It would be nice to resize my main frame when the SIP is in the
>> way.
> 
> You need to do the following:
> 
> 1. Allocate a SHACTIVATEINFO structure
> 2. When your main window receives a WM_SETTINGCHANGE message, call 
> SHHandleWMSettingChange() passing the structure
> 3. When you receive WM_ACTIVATE, call SHHandleWMActivate() passing the
> same 
> structure
> 
> The resizing of your window will now be done for you.
> 
> Luke
> 
> class SHACTIVATEINFO(ctypes.Structure):
>     _fields_ = [
>         ('cbSize', DWORD),
>         ('hwndLastFocus', HWND),
>         ('flags', UINT),
>     ]
> 
>     def __init__(self):
>         ctypes.Structure.__init__(self)
>         self.cbSize = ctypes.sizeof(self)
> 
>     aygshell = ctypes.cdll.aygshell
> 
>     SHHandleWMSettingChange = aygshell[83]
>     SHHandleWMSettingChange.argtypes = [ HWND, WPARAM, LPARAM, 
> ctypes.POINTER(SHACTIVATEINFO) ]
>     SHHandleWMSettingChange.restype = BOOLRESULT
> 
>     SHHandleWMActivate = aygshell[84]
>     SHHandleWMActivate.argtypes = [ HWND, WPARAM, LPARAM, 
> ctypes.POINTER(SHACTIVATEINFO), DWORD ]
>     SHHandleWMActivate.restype = BOOLRESULT
> 
> _______________________________________________
> PythonCE mailing list
> PythonCE at python.org
> http://mail.python.org/mailman/listinfo/pythonce
> 
> 

-- 
View this message in context: http://www.nabble.com/One-other-question%3A-detecting-SIP-tf3298456.html#a9204772
Sent from the Python - pythonce mailing list archive at Nabble.com.



More information about the PythonCE mailing list