Page 1 of 1

#PB_Event_GadgetFocus

Posted: Wed Feb 17, 2021 3:55 pm
by BarryG
Per what TI-994A said here -> viewtopic.php?p=565895#p565895

We need a way to detect when any of our gadgets get the focus (as shown when the dotted focus rectangle is on them), without resorting to silly hacks like I did by comparing old/new GetActiveGadget(), or like TI-994A did by using AddKeyboardShortcut().

Thanks!

Re: #PB_Event_GadgetFocus

Posted: Wed Feb 17, 2021 7:11 pm
by STARGÅTE
This event is implemented in EventType(): #PB_EventType_Focus

Code: Select all

OpenWindow(1, 200, 200, 300, 100, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)

StringGadget(1, 10, 10, 280, 25, "A")
StringGadget(2, 10, 40, 280, 25, "B")
StringGadget(3, 10, 70, 280, 25, "C")

SetActiveGadget(1)

Repeat
	
	Select WaitWindowEvent()
		Case #PB_Event_CloseWindow
			End
		Case #PB_Event_Gadget
			Select EventType()
				Case #PB_EventType_Focus
					Debug "Focus on gadget #"+EventGadget()
			EndSelect
	EndSelect
	
ForEver

Re: #PB_Event_GadgetFocus

Posted: Thu Feb 18, 2021 3:18 am
by BarryG
STARGÅTE, I know that, but #PB_EventType_Focus doesn't support all gadgets that use the keyboard (such as ComboBoxGadgets), which is what this request is about.

I did say this request is to support "any gadget that gets the dotted focus rectangle on them", which means it's a keyboard-supported gadget. <Wink>.

Re: #PB_Event_GadgetFocus

Posted: Thu Feb 18, 2021 6:22 pm
by STARGÅTE
@BarryG, you are right. I did not noticed, that the list of supported gadget is relatively small and gadgets like Button or CheckBox are not included.