[bb] Two new button styles using API by Cold Harbour [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:42

Previous topic - Next topic

BlitzBot

Title : Two new button styles using API
Author : Cold Harbour
Posted : 1+ years ago

Description : 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.


Code :
Code (blitzbasic) Select
; .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 :


Blaine(Posted 1+ years ago)

 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.(Posted 1+ years ago)

 Crash here on XP. Latest B+ 1.41


KnorxThieus(Posted 1+ years ago)

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