Stringgadget and lost focus

Just starting out? Need help? Post your questions and find answers here.
pel
New User
New User
Posts: 5
Joined: Sun May 04, 2003 3:34 pm

Stringgadget and lost focus

Post by pel »

Just curious why I get a "lost focus" event for a stringgadget each time I type in a character (although the focus actually stays on the stringgadget). I get the lost focus event using either #PB_EventType_LostFocus or #EN_KILLFOCUS.

As an example, if you take the "Gadget" example program and add a check for lost focus and a debug message under "Case 0" (the stringgadget), you'll see a "lost focus" message pop up in the debug window each time you type a character. :?
Sub-Routine
User
User
Posts: 82
Joined: Tue May 03, 2005 2:51 am
Location: Wheeling, Illinois, USA
Contact:

Post by Sub-Routine »

Works as expected here. I only see the Lost Focus when tabbing to or clicking another gadget.

I use it in my program to update other gadgets only after the user has finished input to certain gadgets.

PB 393, XP Pro SP2

Rand
pel
New User
New User
Posts: 5
Joined: Sun May 04, 2003 3:34 pm

Post by pel »

Sorry, I didn't make this clear - I've got a "lost focus" routine in my program and everything works OK -- it's just that the "lost focus" routine gets executed every time a character is entered. It seems to be getting both a "Change" and "Lost focus" event with each character, although the focus isn't actually "lost" -- it stays on the stringgadget until you actually tab or click to another gadget.
Sub-Routine
User
User
Posts: 82
Joined: Tue May 03, 2005 2:51 am
Location: Wheeling, Illinois, USA
Contact:

Post by Sub-Routine »

Here is how I use it:

Code: Select all

    ElseIf GadgetID = #Final_Drive_Whole_Input
      Gosub Final_Drive
      If EventType() = #PB_EventType_LostFocus
        Gosub GearRatios
        Gosub Speed_Per_Mile
      EndIf
The Final_Drive_Whole_Input is a string gadget which I interpret into a Float value in Final_Drive which updates only one gadget, and updates for every keypress.

After the user moves to another gadget (LostFocus) GearRatios (as many as 35 gadgets) and Speed_Per_Mile (a ListIcon, often containing 200 or more entries) are updated.

I don't understand why it isn't functioning for you.

Rand
Post Reply