Just starting out? Need help? Post your questions and find answers here.
Randy Walker
Addict
Posts: 1162 Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA
Contact:
Post
by Randy Walker » Fri Nov 07, 2025 9:09 pm
I've tried to approach this from many angles but can't seem to nail it down. The box does not fill when I click on it and cannot capture the change:
Code: Select all
If OpenWindow(0, 0, 0, 132, 75, "CheckboxGadget Flag", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CheckBoxGadget(2, 8, 10, 106, 20, "Show Password")
Repeat
ev = WaitWindowEvent()
Select ev
Case #PB_Event_Gadget
If GetGadgetState(1) = #PB_Checkbox_Checked
Debug "Checked"
Else
Debug "UnChecked"
EndIf
EndSelect
Until ev = #PB_Event_CloseWindow
EndIf
Last edited by
Randy Walker on Fri Nov 07, 2025 10:37 pm, edited 1 time in total.
- - - - - - - - - - - - - - - -
Randy
I *never * claimed to be a programmer.
mk-soft
Always Here
Posts: 6388 Joined: Fri May 12, 2006 6:51 pm
Location: Germany
Post
by mk-soft » Fri Nov 07, 2025 9:19 pm
Tips
Code: Select all
;- TOP
; Use always EnableExplicit, to find typos
EnableExplicit
; Use Enumerations, to avoid incorrect numbers
Enumeration FormWindows
#Main
EndEnumeration
Enumeration FormMenuBars
;
EndEnumeration
Enumeration FormMenuItems
;
EndEnumeration
Enumeration FormGadgets
#MainCheckbox
EndEnumeration
Global ev
If OpenWindow(#Main, 0, 0, 132, 75, "CheckboxGadget Flag", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CheckBoxGadget(#MainCheckbox, 8, 10, 106, 20, "Show Password")
Repeat
ev = WaitWindowEvent()
Select ev
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Main
Break
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case #MainCheckbox
If GetGadgetState(#MainCheckbox) = #PB_Checkbox_Checked
Debug "Checked"
Else
Debug "UnChecked"
EndIf
EndSelect
EndSelect
ForEver
EndIf
Last edited by
mk-soft on Fri Nov 07, 2025 9:23 pm, edited 1 time in total.
RASHAD
PureBasic Expert
Posts: 5008 Joined: Sun Apr 12, 2009 6:27 am
Post
by RASHAD » Fri Nov 07, 2025 9:20 pm
Hi Randy
Your checkbox id is 2 not 1
And better use
Egypt my love
mk-soft
Always Here
Posts: 6388 Joined: Fri May 12, 2006 6:51 pm
Location: Germany
Post
by mk-soft » Fri Nov 07, 2025 9:26 pm
RASHAD wrote: Fri Nov 07, 2025 9:20 pm
Hi Randy
Your checkbox id is 2 not 1
And better use
#PB_CheckBox_Checked is right !
Randy Walker
Addict
Posts: 1162 Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA
Contact:
Post
by Randy Walker » Fri Nov 07, 2025 10:36 pm
Thank you RASHAD and Thank you mk-soft.
My real goal was trying to create a Show Password Checkbox but I found a really great solution from Piero:
viewtopic.php?p=634703#p634703
- - - - - - - - - - - - - - - -
Randy
I *never * claimed to be a programmer.
Randy Walker
Addict
Posts: 1162 Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA
Contact:
Post
by Randy Walker » Sun Nov 09, 2025 12:13 am
Huh? I would not want to restrict users to numeric only passwords. Who does that?
- - - - - - - - - - - - - - - -
Randy
I *never * claimed to be a programmer.
Piero
Addict
Posts: 1102 Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy
Post
by Piero » Sun Nov 09, 2025 12:42 am
Randy Walker wrote: Sun Nov 09, 2025 12:13 am
Huh? I would not want to restrict users to numeric only passwords. Who does that?
Code: Select all
Global StringGadgetFlags ; = #PB_String_Numeric ; set to 0 for normal password