Detecting 'Enter' key on StringGadget?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Maybe this is really obvious, but I can't do it... how can my StringGadget know when I've pressed 'Enter' on it after typing some text? :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

HI,

If i remember well, the string gadget send a #PB_EventGadget when you press enter.
so you just have to check for it

Hope it helps...

Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Hi Mr Skunk, sorry but I still can't work it out... :(
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Paul.

Hey PB, this works for me...

Code: Select all

If OpenWindow(0, 10, 10, 200, 200, #PB_Window_SystemMenu, "Test")
  Repeat
    EventID.l = WaitWindowEvent()  
    
    If EventwParam()=13
      MessageRequester("","You Pressed Enter",0)
    EndIf 

  Until EventID = #PB_EventCloseWindow
EndIf
End



Edited by - paul on 17 October 2001 06:28:17
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Hi Paul, unfortunately your example only works because there's no gadgets on the form. :) When I added a StringGadget, your example doesn't work anymore...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Paul.

Hmmm, you are correct.
Nothing is returned when the focus is on a StringGadget.

Fred ??
Post Reply