Restored from previous forum. Originally posted by Shagwana.
When you create a image or text button, it will return a handle. With this handle you can toggle it (set it into a up/down state) using;
SendMessage_(handle,#BM_SETSTATE,1,0)
and...
SendMessage_(handle,#BM_SETSTATE,0,0)
Might also be usefull on other types of gadgets. Maybe someone will find that usefull?
http://www.sublimegames.com
How to toggle a button
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by TronDoc.
I've said this before, and some folks are doing it,
but it would be nice when code is
presented to always have a way of knowing which
O.S. the code is applicable to and whether
or not an external library, .dll, API
call or whatever is required...
Joe
Edited by - TronDoc on 09 February 2002 11:47:57
I've said this before, and some folks are doing it,
but it would be nice when code is
presented to always have a way of knowing which
O.S. the code is applicable to and whether
or not an external library, .dll, API
call or whatever is required...
Joe
Edited by - TronDoc on 09 February 2002 11:47:57
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Shagwana.
Its a windows api function and works on 98,2000 and XP as far as i know!
http://www.sublimegames.com
Its a windows api function and works on 98,2000 and XP as far as i know!
http://www.sublimegames.com
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
have Windows do the toggling for you, just create a CheckBox (yes!) like so:
; CheckBox looks and acts like a toggle button.
cb=CheckBoxGadget(#Gadget, x, y, Width, Heigth, Text$)
SetWindowLong_(cb,#GWL_STYLE,GetWindowLong_(cb,#GWL_STYLE)|$1000)
PB - Registered PureBasic Coder
Edited by - PB on 17 February 2002 10:58:25
The above is good for manually toggling a button's state, but if you'd ratherSendMessage_(handle,#BM_SETSTATE,1,0)
SendMessage_(handle,#BM_SETSTATE,0,0)
have Windows do the toggling for you, just create a CheckBox (yes!) like so:
; CheckBox looks and acts like a toggle button.
cb=CheckBoxGadget(#Gadget, x, y, Width, Heigth, Text$)
SetWindowLong_(cb,#GWL_STYLE,GetWindowLong_(cb,#GWL_STYLE)|$1000)
PB - Registered PureBasic Coder
Edited by - PB on 17 February 2002 10:58:25