Posted: Sat Feb 22, 2003 3:18 pm
Restored from previous forum. Originally posted by TeddyLM.
Hi everybody.
I'm working on a small application (with StringGadgets).
I'm looking for a way to jump from an active (and highlighted) StringGadget to another one when i press RETURN.
The problem is ... when i press the Return Key, it jumps twice (to the third one) !!?
What did i do wrong ? Some help would be nice.
Thanks.
Teddylm
A registered PB-Apprentice
Here's a small example :
;************************************
If OpenWindow(0, 200, 200, 150, 150, #PB_Window_MinimizeGadget, "TestString")
;CREATE STRINGGADGET
If CreateGadgetList(WindowID())
StringGadget (0, 40, 38, 80, 17, "String Nr.0")
StringGadget (1, 40, 58, 80, 17, "String Nr.1")
StringGadget (2, 40, 78, 80, 17, "String Nr.2")
EndIf
;SET FOCUS ON STRINGGADGET 0
Sendmessage_(GadgetID(0), #EM_SETSEL, 0, -1)
SetGadgetState(0,1)
ActivateGadget(0)
Repeat
EventID = WindowEvent()
ActualPos = EventGadgetID()
If EventwParam()=13 ;Key Return Pressed
If ActualPos = 0
SetGadgetState(0,0)
SetGadgetState(1,1)
Sendmessage_(GadgetID(1), #EM_SETSEL, 0, -1)
ActivateGadget(1)
ElseIf ActualPos = 1
SetGadgetState(1,0)
SetGadgetState(2,1)
Sendmessage_(GadgetID(2), #EM_SETSEL, 0, -1)
ActivateGadget(2)
Else
SetGadgetState(2,0)
SetGadgetState(0,1)
Sendmessage_(GadgetID(0), #EM_SETSEL, 0, -1)
ActivateGadget(0)
EndIf
EndIf
Until WindowEvent() = #PB_EventCloseWindow
EndIf

(New registered PB-Apprentice...
a long long way from home)
Hi everybody.
I'm working on a small application (with StringGadgets).
I'm looking for a way to jump from an active (and highlighted) StringGadget to another one when i press RETURN.
The problem is ... when i press the Return Key, it jumps twice (to the third one) !!?
What did i do wrong ? Some help would be nice.
Thanks.
Teddylm
A registered PB-Apprentice
Here's a small example :
;************************************
If OpenWindow(0, 200, 200, 150, 150, #PB_Window_MinimizeGadget, "TestString")
;CREATE STRINGGADGET
If CreateGadgetList(WindowID())
StringGadget (0, 40, 38, 80, 17, "String Nr.0")
StringGadget (1, 40, 58, 80, 17, "String Nr.1")
StringGadget (2, 40, 78, 80, 17, "String Nr.2")
EndIf
;SET FOCUS ON STRINGGADGET 0
Sendmessage_(GadgetID(0), #EM_SETSEL, 0, -1)
SetGadgetState(0,1)
ActivateGadget(0)
Repeat
EventID = WindowEvent()
ActualPos = EventGadgetID()
If EventwParam()=13 ;Key Return Pressed
If ActualPos = 0
SetGadgetState(0,0)
SetGadgetState(1,1)
Sendmessage_(GadgetID(1), #EM_SETSEL, 0, -1)
ActivateGadget(1)
ElseIf ActualPos = 1
SetGadgetState(1,0)
SetGadgetState(2,1)
Sendmessage_(GadgetID(2), #EM_SETSEL, 0, -1)
ActivateGadget(2)
Else
SetGadgetState(2,0)
SetGadgetState(0,1)
Sendmessage_(GadgetID(0), #EM_SETSEL, 0, -1)
ActivateGadget(0)
EndIf
EndIf
Until WindowEvent() = #PB_EventCloseWindow
EndIf
(New registered PB-Apprentice...
a long long way from home)