Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   PythonWin dynamic toolbar (http://www.velocityreviews.com/forums/t319343-pythonwin-dynamic-toolbar.html)

Ilariu Raducan 07-07-2003 12:40 PM

PythonWin dynamic toolbar
 
Hi All,
I'm trying to create a dynamic toolbar.
This function tries to create the toolbar and add a button to it.
It craches at tbctrl.SteBitmapSize(32,32)

What is wrong with it?

Thank you,
Lale


def OnCreateClient(self,context,obj):
window.MDIChildWnd.OnCreateClient(self,context,obj )
parent = self
style = win32con.WS_CHILD | win32con.WS_VISIBLE |
afxres.CBRS_SIZE_DYNAMIC | afxres.CBRS_TOP | \
afxres.CBRS_TOOLTIPS | afxres.CBRS_FLYBY
self.toolbar = tb = win32ui.CreateToolBar (parent, style)
tbctrl = tb.GetToolBarCtrl()
tbctrl.SetBitmapSize(32,32)
bmp = win32ui.CreateBitmap()
bmp.LoadBitmapFile(open('importimages.bmp','r'))
bmpIndex = tbctrl.AddBitmap(1,bmp)
tbctrl.AddStrings('rect\0point\0poligon\0')
tbutton = tbctrl.TBUTTON
tbutton[0]=(bmpIndex,868,win32con.TBSTATE_ENABLED,
win32con.TBSTYLE_BUTTON,None,0)
tbctrl.AddButtons(1,tbutton)
tb.EnableDocking(afxres.CBRS_ALIGN_ANY)
tb.SetWindowText("Test")
parent.EnableDocking(afxres.CBRS_ALIGN_ANY)
parent.DockControlBar(tb)
print tbctrl.GetButtonCount()
return 1



All times are GMT. The time now is 11:47 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.