I'm trying to create a button with two states, on and off(also trying to create one with 3 states, but I'm taking it one-step at a time). The original BmpButton accepts two bitmap id's as input, but uses them for "button down" and "button up". I had two ideas, either just create a new BmpButton proc which works with a toggle system(probably easier), or figure out a way how to change the image from with some sort of message thing(I think this would be harder, but would give me more control) , I was playing around with BM_SETIMAGE but for some reason I just fail at using it:(.

If someone could write a little example, or send me in the right direction, I'd be really great full. Sorry for sounding like a "noob", I'm not yet proficient in ASM.

PS: if you send me to google, tell me what to search for. If it is on there, I must have been searching for the wrong things.
Posted on 2009-04-10 14:38:54 by Silva
Here is a link to Ewayne's Button program which was posted on Iczelions homepage. I remember looking it up when I did the fancy button theme.

http://win32assembly.online.fr/files/Buttons.zip
Posted on 2009-04-10 15:18:19 by JimmyClif
Hi, thank you for the reply. I took some time to look over the example, while it did increase my knowledge about all the different types of buttons you can create, it didn't help me achieve my goal (maybe I missed something?). I kind of manged to achieve my target, but I'm not very happy with the solution.

I created two buttons at the same location. One of them is hidden at the start. When you press the first button it hides it self, and makes the other button visible. This gives an illusion of "toggle" but it feels quite cheap. And when I do it with 3 states, I'd have to create 3 buttons... Just feels really unnecessary.

Any other suggestions?
Posted on 2009-04-11 03:08:28 by Silva
I believe the problem with Ewayne's Button program is that it shows too many buttons.

Creating multiple buttons and hiding them is unnecessary as shown with Ewayne's Button program.

Without looking at the source I believe he subclasses the button and then intercepts the WM_MOUSEOVER, WM_LBUTTONDOWN and loads another picture onto the button to create the illusion of another state.

I think you should re-visit the code.
Posted on 2009-04-11 08:12:27 by JimmyClif