Re: abstract layer question
Robin Becker <[email protected]>
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <[email protected]> |
In article <[email protected]>, Magnus Lie Hetland <[email protected]> writes .. ... >) > >Well, this proxy.setRange was exactly what Robin needed here, to do >some extra work before calling the push machinery (through set()). I >think this should stay in one form or another. And I don't really have >anything against the way it currently works. > >> Cheers, > well if anyone cares in the end I used the following for my ProgressBar, the problem is now in setPos as the skeleton only seems to have 'pos' in [0,1]. Incidentally is there now any real reason to keep the defaults separate from their clients? #proxy class class ProgressBar(Component): state = { 'text': 'ProgressBar', 'x': 0, 'y': 0, 'width': 100, 'height': 15, 'hmove': 0, 'vmove': 0, 'hstretch': 0, 'vstretch': 0, 'visible': 1, 'enabled': 1, 'pos': 0., } def setPos(self,pos): assert 0<=pos<=1, "pos not in range" self.state['pos'] = pos self.wrapper.setPos(pos) def wrapperFactory(self): return backendModule().ProgressBarWrapper(self) #dwgui implementation (should be easy in msw as well) class ProgressBarWrapper(ComponentWrapper): _wndclass = "msctls_progress32" _win_style = WS_VISIBLE | WS_CHILD | PBS_SMOOTH def setPos(self,pos): if self.noWidget(): return #I tried to set range only once, but it didn't work user32.SendMessage(self.widget, PBM_SETRANGE, 0, 0xffff0000) return user32.SendMessage(self.widget, PBM_SETPOS, int(pos*0xffff), 0) -- Robin Becker ------------------------------------------------------- This sf.net email is sponsored by: Jabber - The world's fastest growing real-time communications platform! Don't just IM. Build it in! http://www.jabber.com/osdn/xim