It is currently Thu Nov 21, 2019 9:48 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: CheckBox 4 Windows
PostPosted: Sat Jul 06, 2019 2:55 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3458
Hi all
No Windows CallBack
No SubClassing

Code:
#BST_UNCHECKED       = $0000
#BST_CHECKED            = $0001
#BST_INDETERMINATE  = $0002
#BST_PUSHED              = $0004
#BST_FOCUS                = $0008

;SendMessage(CheckBox, #BM_SETCHECK, #BST_CHECKED, 0)
;SendMessage(CheckBox, #BM_GETCHECK, 0, 0)

If OpenWindow(0, 0, 0, 280, 100, "CheckBox Demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

  CheckBoxGadget(0, 10, 10, 80,20,"CheckBox #1",#SS_NOTIFY) 
  CheckBoxGadget(1, 10, 50, 80,20,"CheckBox #2",#SS_NOTIFY)
 
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Quit = 1
     
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 0
          Debug SendMessage_(GadgetID(0) , #BM_GETCHECK, 0, 0)
         
        Case 1
          Debug SendMessage_(GadgetID(1) , #BM_GETCHECK, 0, 0)
      EndSelect

  EndSelect
Until Quit = 1
EndIf

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: CheckBox 4 Windows
PostPosted: Sat Jul 06, 2019 9:50 am 
Offline
Enthusiast
Enthusiast

Joined: Tue May 26, 2009 2:11 pm
Posts: 618
Hi Rashad!

Hm, what's the advantage of your code over this one?
Code:
If OpenWindow(0, 0, 0, 280, 100, "CheckBox Demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CheckBoxGadget(0, 10, 10, 80,20,"CheckBox #1")
  CheckBoxGadget(1, 10, 50, 80,20,"CheckBox #2")
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 0
            Debug GetGadgetState(0)
          Case 1
            Debug GetGadgetState(1)
        EndSelect
    EndSelect
  Until Quit = 1
EndIf

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: CheckBox 4 Windows
PostPosted: Sat Jul 06, 2019 11:27 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3458
Hi Lord
Nothing
It is mainly for old versions of PB and API CheckBox
I just noticed that there is a version using Windows Callback by NM
And another version by nco2k using subclassing
Just to complete searching :)

Code:
#BST_UNCHECKED      = $0000
#BST_CHECKED        = $0001
#BST_INDETERMINATE  = $0002
#BST_PUSHED         = $0004
#BST_FOCUS          = $0008

;SendMessage(CheckBox, BM_SETCHECK, BST_CHECKED, 0)
;SendMessage(CheckBox, BM_GETCHECK, 0, 0)

If OpenWindow(0, 0, 0, 280, 100, "CheckBox Demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CheckBox = CreateWindowEx_(0, "BUTTON", "Hello",#WS_CHILD | #WS_VISIBLE | #BS_AUTOCHECKBOX,10, 10, 100, 20, WindowID(0), 0, GetModuleHandle_(0), 0)
 
  ButtonGadget(1,10,50,60,20,"RUN")
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Quit = 1
     
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 1
          Debug SendMessage_(CheckBox , #BM_GETCHECK, 0, 0)
      EndSelect

  EndSelect
Until Quit = 1
EndIf

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: CheckBox 4 Windows
PostPosted: Sun Jul 07, 2019 9:44 am 
Offline
Enthusiast
Enthusiast

Joined: Tue May 26, 2009 2:11 pm
Posts: 618
Hi Rashad!
RASHAD wrote:
...
Nothing
It is mainly for old versions of PB and API CheckBox
I just noticed that there is a version using Windows Callback by NM
And another version by nco2k using subclassing
Just to complete searching :)
...
Ah, I understand. Thank you for clarification.

_________________
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye