
ButtonGadgetEx - Images as Button
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: ButtonGadgetEx - Images as Button
...wow, that looks really excellent, fabulous piece of work. Thanks for sharing. 

IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: ButtonGadgetEx - Images as Button
Hi mevedia,
try this:You can not add the alpha to each colour.
It is an extra byte wich defines the transparancy for the complete pixel.
If you want it a bit faster, you can useBut I think this is not working on all plattforms.
Bernd
try this:
Code: Select all
Procedure GrayscaleCallback(x, y, SourceColor, TargetColor)
Define Gray.i
Gray = (Red(SourceColor) * 77 + Green(SourceColor) * 150 + Blue(SourceColor) * 29) >> 8
ProcedureReturn RGBA(Gray, Gray, Gray, Alpha(SourceColor))
EndProcedure
It is an extra byte wich defines the transparancy for the complete pixel.
If you want it a bit faster, you can use
Code: Select all
ProcedureReturn Gray|Gray<<8|Gray<<16|Alpha(SourceColor)<<24
Bernd
- Andre
- PureBasic Team
- Posts: 2139
- Joined: Fri Apr 25, 2003 6:14 pm
- Location: Germany (Saxony, Deutscheinsiedel)
- Contact:
Re: ButtonGadgetEx - Images as Button
...avoiding the GetSysColor_() WinAPI function it also works on MacOS. Thanks!
(Don't know if it works exactly like on Windows, as I don't have my PC running at the moment...)

(Don't know if it works exactly like on Windows, as I don't have my PC running at the moment...)
Re: ButtonGadgetEx - Images as Button
It's nice code and another good example for the canvas gadget, thank you for sharing it 
But what the "Toggle" button should do ? I saw it should toggle the gadget (_ex) status but I don't see anything happen when I press the button. Maybe I didn't understand it...
A side note about something you probably are already aware of: in a real program keep in mind you should trap the alt-tab in some way to navigate to the _ex buttons too, or a user would find strange not being able to do so.

But what the "Toggle" button should do ? I saw it should toggle the gadget (_ex) status but I don't see anything happen when I press the button. Maybe I didn't understand it...
A side note about something you probably are already aware of: in a real program keep in mind you should trap the alt-tab in some way to navigate to the _ex buttons too, or a user would find strange not being able to do so.
"Have you tried turning it off and on again ?"
Re: ButtonGadgetEx - Images as Button
When you press the mouse outside the button, then drag it inside and release, the button gets pressed. It should only get pressed when the click is both started and ended inside the gadget.