Code archives/BlitzPlus Gui/Two new button styles using API

This code has been declared by its author to be Public Domain code.

Download source code

Two new button styles using API by Cold Harbour2005
This code adds two new button styles:
A three state tick box - new state is greyed.
A chunky push button. Can't think of another way to put it.
; 	.lib "User32.dll"
;	SendMessage%(hWnd%,Msg%,wParam%,lParam%):"SendMessageA" 

Const BM_SETSTYLE	=	244
Const BS_AUTO3STATE	=	6
Const BS_DEFPUSHBUTTON	=	1

win=CreateWindow ("Win",10,10,600,300,main,1)

button1=api_CreateButton("Tickbox with three states",10,10,300,20,win,BS_AUTO3STATE)

button2=api_CreateButton("Chunky button",10,50,200,30,win,BS_DEFPUSHBUTTON)

While WaitEvent(10)<>$803
Wend
End 

Function api_CreateButton(title$,x, y, w, h, parent,style) 

	button = CreateButton(title, x, y, w, h, parent)
	hwnd = QueryObject(button, 1)
	SendMessage (hwnd, BM_SETSTYLE, style  ,1)
	Return button

End Function

Comments

Blaine2005
It's funny... I found out about the "half-checkable" boxes (as I call them) too! And I did it in the same way! Unfortunately, you need some sort of way to tell how many times the thing's been clicked to find the state, as it will return a ButtonState() of 0 if it's half-checked.


mag.2005
Crash here on XP. Latest B+ 1.41


KnorxThieus2014
Hello,
I'd be very thankful if someone could update the code for compatibility for Win 8.
thx


Code Archives Forum