However, if the cursor is not inside the string input field (i.e. click anywhere else on the window area before clicking the button), then the button gadget only requires a single click. This I think is inconsistent with Windows applications generally, where the buttons can be single-clicked whenever required. I don't know if this is a behaviour that can be controlled or is a known anomaly, as I've only just started using PB. I also notice that behaviour sometimes varies. If the user clicks inside the string input, but doesn't change the existing input value, then clicks the button, the button only requires a single click. It therefore doesn't seem to be working as it ought to.
Here is the code, which is just a simple example from this forum. I've tried other code examples too that behave in exactly the same way, so it doesn't appear to be anything wrong with the below, unless there's something I've missed.
MyForm.pbf
Code: Select all
; This code is automatically generated by the FormDesigner.
Global Window_0
Global Button_0, String_0, Text_0
Declare buttonEvent(EventType)
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
Button_0 = ButtonGadget(#PB_Any, 40, 170, 150, 50, "Click Me")
String_0 = StringGadget(#PB_Any, 40, 30, 290, 25, "")
Text_0 = TextGadget(#PB_Any, 40, 70, 200, 30, "This is a label")
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case Button_0
buttonEvent(EventType())
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
Code: Select all
XIncludeFile "MyForm.pbf"
Procedure buttonEvent(eventType.i)
SetGadgetText(Text_0, GetGadgetText(String_0))
EndProcedure
OpenWindow_0()
Repeat
event = WaitWindowEvent()
Until Window_0_Events(event) = #False
End
test3.pbf
Code: Select all
; This code is automatically generated by the FormDesigner.
Global Window_0
Global String_0, Button_0
Declare buttonEvent(EventType)
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
String_0 = StringGadget(#PB_Any, 40, 20, 200, 40, "")
Button_0 = ButtonGadget(#PB_Any, 40, 90, 100, 25, "Exit")
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case Button_0
buttonEvent(EventType())
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
Code: Select all
XIncludeFile "test3.pbf"
OpenWindow_0()
Procedure buttonEvent(eventType.i)
End
EndProcedure
Repeat
event = WaitWindowEvent()
Until Window_0_Events(event) = #False
End