October 28, 2020, 06:06:11 AM

Author Topic: [bb] Two new button styles using API by Cold Harbour [ 1+ years ago ]  (Read 1132 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
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
  1. ;       .lib "User32.dll"
  2. ;       SendMessage%(hWnd%,Msg%,wParam%,lParam%):"SendMessageA"
  3.  
  4. Const BM_SETSTYLE       =       244
  5. Const BS_AUTO3STATE     =       6
  6. Const BS_DEFPUSHBUTTON  =       1
  7.  
  8. win=CreateWindow ("Win",10,10,600,300,main,1)
  9.  
  10. button1=api_CreateButton("Tickbox with three states",10,10,300,20,win,BS_AUTO3STATE)
  11.  
  12. button2=api_CreateButton("Chunky button",10,50,200,30,win,BS_DEFPUSHBUTTON)
  13.  
  14. While WaitEvent(10)<>$803
  15. Wend
  16. End
  17.  
  18. Function api_CreateButton(title$,x, y, w, h, parent,style)
  19.  
  20.         button = CreateButton(title, x, y, w, h, parent)
  21.         hwnd = QueryObject(button, 1)
  22.         SendMessage (hwnd, BM_SETSTYLE, style  ,1)
  23.         Return button
  24.  
  25. 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


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal