[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9447 - trunk/gnue-forms/src/uidrivers/win32/widgets
From: |
btami |
Subject: |
[gnue] r9447 - trunk/gnue-forms/src/uidrivers/win32/widgets |
Date: |
Sat, 24 Mar 2007 05:55:20 -0500 (CDT) |
Author: btami
Date: 2007-03-24 05:55:19 -0500 (Sat, 24 Mar 2007)
New Revision: 9447
Modified:
trunk/gnue-forms/src/uidrivers/win32/widgets/toolbar.py
trunk/gnue-forms/src/uidrivers/win32/widgets/toolbutton.py
Log:
toolbar fixes for embedded forms
Modified: trunk/gnue-forms/src/uidrivers/win32/widgets/toolbar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/widgets/toolbar.py 2007-03-19
15:06:45 UTC (rev 9446)
+++ trunk/gnue-forms/src/uidrivers/win32/widgets/toolbar.py 2007-03-24
10:55:19 UTC (rev 9447)
@@ -50,7 +50,7 @@
Creates a new toolbar widget.
"""
- widget = None
+ widget = self._container = None
if self._gfObject.name == '__main_toolbar__' \
and not self._form._features['GUI:TOOLBAR:SUPPRESS']:
@@ -77,8 +77,7 @@
win32gui.SendMessage(mainToolBar.GetHwnd(), commctrl.TB_AUTOSIZE,
0, 0)
mainToolBar.Show()
- self._container = self
-
+ self._container = self
return widget
Modified: trunk/gnue-forms/src/uidrivers/win32/widgets/toolbutton.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/widgets/toolbutton.py 2007-03-19
15:06:45 UTC (rev 9446)
+++ trunk/gnue-forms/src/uidrivers/win32/widgets/toolbutton.py 2007-03-24
10:55:19 UTC (rev 9447)
@@ -65,39 +65,44 @@
self.parent = event.container
self.id = getNextId()
- if label is not None:
- # Set the action icon if available
- if icon_file:
- icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_SHARED
- try:
- him = win32gui.LoadImage(0, str(icon_file),
win32con.IMAGE_BITMAP, 24, 24, icon_flags)
- win32gui.ImageList_Add(self.parent.himl, him, 0)
- except:
- print win32api.FormatMessage(0)
+ if event.container is not None:
+ if label is not None:
+ # Set the action icon if available
+ if icon_file:
+ icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_SHARED
+ try:
+ him = win32gui.LoadImage(0, str(icon_file),
win32con.IMAGE_BITMAP, 24, 24, icon_flags)
+ win32gui.ImageList_Add(self.parent.himl, him, 0)
+ except:
+ print win32api.FormatMessage(0)
- self.parent.toolbar.Connect(self.id, self.__on_tool)
+ self.parent.toolbar.Connect(self.id, self.__on_tool)
-# TBBUTTON stru (iBitmap, idCommand, fsState, fsStyle, dwData, iString)
- tbb=struct.pack("iibbli", self.parent._buttonCount, self.id,
commctrl.TBSTATE_ENABLED, style, 0, 0)
- win32gui.SendMessage(self.parent.toolbar.GetHwnd(),
commctrl.TB_ADDBUTTONS, 1, tbb)
- # i have to count myself 'coz TB_BUTTONCOUNT counts separators
too...
- self.parent._buttonCount += 1
+ # TBBUTTON stru (iBitmap, idCommand, fsState, fsStyle, dwData, iString)
+ tbb=struct.pack("iibbli", self.parent._buttonCount, self.id,
commctrl.TBSTATE_ENABLED, style, 0, 0)
+ win32gui.SendMessage(self.parent.toolbar.GetHwnd(),
commctrl.TB_ADDBUTTONS, 1, tbb)
+ # i have to count myself 'coz TB_BUTTONCOUNT counts separators
too...
+ self.parent._buttonCount += 1
-# TOOLINFO stru (cbSize, uFlags, hwnd, uId, rect, hinst, lpszText, lParam)
- buff = array.array('c', '%s \0x00' % (textEncode(description) or
''))
- addrText = buff.buffer_info()[0]
- format = "IIiIllllili"
- size = struct.calcsize(format)
- ti = struct.pack(format, size, 0, self.parent.toolbar.GetHwnd(),
self.id, 0, 0, 0, 0, 0, addrText, 0)
- win32gui.SendMessage(self.parent._htt, commctrl.TTM_UPDATETIPTEXT
, 0, ti)
+ # TOOLINFO stru (cbSize, uFlags, hwnd, uId, rect, hinst, lpszText,
lParam)
+ buff = array.array('c', '%s \0x00' % (textEncode(description)
or ''))
+ addrText = buff.buffer_info()[0]
+ format = "IIiIllllili"
+ size = struct.calcsize(format)
+ ti = struct.pack(format, size, 0,
self.parent.toolbar.GetHwnd(), self.id, 0, 0, 0, 0, 0, addrText, 0)
+ win32gui.SendMessage(self.parent._htt,
commctrl.TTM_UPDATETIPTEXT , 0, ti)
- widget = ToolButton(self.parent, self.id, self.check)
+ widget = ToolButton(self.parent, self.id, self.check)
- else:
+ else:
+ widget = None
+ tbb=struct.pack("iibbli", 0, 0, commctrl.TBSTATE_ENABLED,
commctrl.TBSTYLE_SEP, 0, 0)
+ win32gui.SendMessage(self.parent.toolbar.GetHwnd(),
commctrl.TB_ADDBUTTONS, 1, tbb)
+
+ else:
+ # TOOLBAR:SUPPRESS was set
widget = None
- tbb=struct.pack("iibbli", 0, 0, commctrl.TBSTATE_ENABLED,
commctrl.TBSTYLE_SEP, 0, 0)
- win32gui.SendMessage(self.parent.toolbar.GetHwnd(),
commctrl.TB_ADDBUTTONS, 1, tbb)
-
+
self.__widget = widget
return widget
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9447 - trunk/gnue-forms/src/uidrivers/win32/widgets,
btami <=