Page 1 of 1

Posted: Thu Nov 29, 2007 5:22 pm
by netmaestro
You're in luck. The StringGadget supports two very handy events, #PB_EventType_Focus and #PB_EventType_LostFocus. So you can have your shortcut active only when the string gadget has the focus and at no other time:

Code: Select all

Select Event
  Case #PB_Event_Gadget
    Select gadget
      Case mystring
        Select EventType()
          Case #PB_EventType_Focus
            ;AddKeyboardShortcut([..])
          Case #PB_EventType_LostFocus
            ;RemoveKeyboardShortcut([..])
        EndSelect
    EndSelect
EndSelect
..and the ding is defeated. Amnesty 1, Gates 0.

Re: #VK_RETURN in Stringgadget

Posted: Thu Nov 29, 2007 8:46 pm
by PB
> Does anybody know, how to avoid it ?

It's in the Coding Questions FAQ:
http://www.purebasic.fr/english/viewtopic.php?t=4876

And your answer (from the FAQ) is here:
http://www.purebasic.fr/english/viewtopic.php?t=3802

Posted: Thu Nov 29, 2007 9:04 pm
by netmaestro
Unsupported Windows-only stuff in the FAQ? Isn't even identified as such.

Posted: Fri Nov 30, 2007 10:00 am
by PB
> Unsupported Windows-only stuff in the FAQ?

SendMessage is documented/supported by Windows.

> Isn't even identified as such

Who said it had to be?

Re: #VK_RETURN in Stringgadget

Posted: Fri Nov 30, 2007 10:12 am
by PB
> It's not a real error, but users can suppose, that something wrong

Well it is an error, because single-line StringGadgets can't have the Enter key
used on them because they're not multi-line. That's why they beep like that.

Posted: Fri Nov 30, 2007 1:31 pm
by Amnesty
Thank you for replies. I'm satisfied.

Thank you PB for this link to FAQ. Mea Culpa, I 've missed that thread, because I haven't searched with the right keywords. (ding dong)

Posted: Fri Nov 30, 2007 3:14 pm
by the.weavster
Control spy is an extremely useful tool for Windows events, SendMessage() etc... http://msdn2.microsoft.com/en-us/library/bb773165.aspx