Re: Win32Lib: Button Color
- Posted by cklester <cklester at yahoo.com> Jul 12, 2004
- 577 views
Derek Parnell wrote: > > cklester wrote: > > > > Is there a way to set a button color and have it stay that way? > > > > I'm using setBackColor(myButt, Red ) > > > > and it draws it red until I click on another control, and it > > returns to its normal gray color. > > I didn't know that one could change the color of a standard > PushButton control! > > Can you show me some example code that does that because I can't > make it happen at all. As far I I know, ou need to have an Owner-Drawn > type of button. Well, looks to be a trick of some sort... Check out this code: -- code generated by Win32Lib IDE v0.18.14 include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 constant Window1 = createEx( Window, "Window1", 0, Default, Default, 353, 237, 0, 0 ) constant PushButton2 = createEx( PushButton, "PushButton2", Window1, 120, 80, 88, 28, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- sequence colors colors = { Red, Green, Blue, Yellow, Black } atom color color = 1 procedure PushButton2_onClick (integer self, integer event, sequence params)--params is () color+=1 if color=6 then color=1 end if setWindowBackColor(self,colors[color]) clearWindow(self) end procedure setHandler( PushButton2, w32HClick, routine_id("PushButton2_onClick")) WinMain( Window1,Normal ) -- end I'm now just trying to use a bmp and mousetrap... -=ck "Programming in a state of EUPHORIA."