Pressing enter in SpinGadget
Pressing enter in SpinGadget
Hi, I've noticed pressing enter while editing the number in a SpinGadget triggers a system beep (Windows 10). Is there a way to prevent this and instead to trigger some action in the program?
Re: Pressing enter in SpinGadget
No beep for me, at least with the example in the doc?paulr wrote:Hi, I've noticed pressing enter while editing the number in a SpinGadget triggers a system beep (Windows 10). Is there a way to prevent this and instead to trigger some action in the program?
A beep can occur if we exceed the defined values.
PS. Note that the mouse wheel can also change the value.

-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Pressing enter in SpinGadget
It possibly depends on the User's Windows Sounds settings.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Pressing enter in SpinGadget
Hi
Code: Select all
If OpenWindow(0, 0, 0, 140, 70, "SpinGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SpinGadget(0, 10, 10, 65, 25, 0, 100,#PB_Spin_Numeric )
TextGadget(1,10,40,60,25,"")
SetGadgetState (0, 5) : SetGadgetText(0, "5")
AddKeyboardShortcut(0, #PB_Shortcut_Return, 10)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Menu
Select EventMenu()
Case 10
If GetActiveGadget() = 0
SetActiveGadget(-1)
SetGadgetText(1,GetGadgetText(0))
EndIf
EndSelect
EndSelect
Until Quit = 1
EndIf
Egypt my love
Re: Pressing enter in SpinGadget
The beep (or more of a windows 'bling') is definitely happening for me.
RASHAD, thanks for the suggestion, that works great in your example (and eliminates the pointless beep).
I've just expanded on it here to show it working on two independent spinners.
Problem solved for me, thank you.
RASHAD, thanks for the suggestion, that works great in your example (and eliminates the pointless beep).
I've just expanded on it here to show it working on two independent spinners.
Code: Select all
If OpenWindow(0, 0, 0, 240, 70, "SpinGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SpinGadget(0, 10, 10, 65, 25, 0, 100,#PB_Spin_Numeric )
TextGadget(1,10,40,60,25,"")
SpinGadget(2, 110, 10, 65, 25, 0, 100,#PB_Spin_Numeric )
TextGadget(3,110,40,60,25,"")
SetGadgetState (0, 5) : SetGadgetText(0, "5")
SetGadgetState (2, 5) : SetGadgetText(0, "5")
AddKeyboardShortcut(0, #PB_Shortcut_Return, 10)
Repeat
e = WaitWindowEvent()
Debug e
Select e
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Menu
Select EventMenu()
Case 10
If GetActiveGadget() = 0
SetActiveGadget(-1)
SetGadgetText(1,Str(Val(GetGadgetText(0))*2))
ElseIf GetActiveGadget() = 2
SetActiveGadget(-1)
SetGadgetText(3,Str(Val(GetGadgetText(2))*2))
EndIf
EndSelect
EndSelect
Until Quit = 1
EndIf