P Pelky Active Member Licensed User Longtime User Feb 7, 2012 #1 Hello all - I am new here and hoping for some help. This may come over daft but I am having a problem with the sequence of entry capture on a form. I find that as you hit the 'enter' key focus goes to the next field down as opposed to across... As I do a lot of forms I need to be able to position on particular areas or logical sections as I move thru a form... I would appreciate any help you can offer.. Thanks
Hello all - I am new here and hoping for some help. This may come over daft but I am having a problem with the sequence of entry capture on a form. I find that as you hit the 'enter' key focus goes to the next field down as opposed to across... As I do a lot of forms I need to be able to position on particular areas or logical sections as I move thru a form... I would appreciate any help you can offer.. Thanks
Ricky D Well-Known Member Licensed User Longtime User Feb 8, 2012 #2 maybe.... not sure if this will do what you want but.... Code: Sub view1_EnterPressed view2.RequestFocus End Sub do that for each view to skip to wherever you want I think that would work. And if you have conditional focussing you test it like Code: Sub view1_EnterPressed 'assuming view1 is an edittext If view1.Text<>"" Then view2.RequestFocus End Sub or Code: Sub view1_EnterPressed 'assuming view1 is an edittext Select view1.Text Case "up" viewup.RequestFocus Case "down" viewdown.RequestFocus Case Else Msgbox("Please choose up or down","Up or Down") End Select End Sub regards, Ricky Upvote 0
maybe.... not sure if this will do what you want but.... Code: Sub view1_EnterPressed view2.RequestFocus End Sub do that for each view to skip to wherever you want I think that would work. And if you have conditional focussing you test it like Code: Sub view1_EnterPressed 'assuming view1 is an edittext If view1.Text<>"" Then view2.RequestFocus End Sub or Code: Sub view1_EnterPressed 'assuming view1 is an edittext Select view1.Text Case "up" viewup.RequestFocus Case "down" viewdown.RequestFocus Case Else Msgbox("Please choose up or down","Up or Down") End Select End Sub regards, Ricky
P Pelky Active Member Licensed User Longtime User Feb 8, 2012 #3 Thank You Ricky - that looks like the beastie I need.. I will try it now but I am sure it will work.... Much appreciated Upvote 0
Thank You Ricky - that looks like the beastie I need.. I will try it now but I am sure it will work.... Much appreciated
P Pelky Active Member Licensed User Longtime User Feb 8, 2012 #4 Sub EditText1_EnterPressed ' validate the date - if invalid go back and redo the date capture Try ValidDate = DateTime.DateParse(EditText1.Text) Catch Msgbox(ValidDate,"Invaild Date Entered "&EditText1.Tag) 'EditText1.Enabled = True 'EditText2.Enabled = False 'EditText3.Enabled = False 'EditText4.Enabled = False EditText1.RequestFocus End Try EditText2.RequestFocus End Sub ********* I have used the above code and what I get is focus going to EditText4 - which is a text field below EditText1... and not EditText2 which is to the right. As U can see I tried enabling/disabling EditText(?) and that actualy works but is ugly Upvote 0
Sub EditText1_EnterPressed ' validate the date - if invalid go back and redo the date capture Try ValidDate = DateTime.DateParse(EditText1.Text) Catch Msgbox(ValidDate,"Invaild Date Entered "&EditText1.Tag) 'EditText1.Enabled = True 'EditText2.Enabled = False 'EditText3.Enabled = False 'EditText4.Enabled = False EditText1.RequestFocus End Try EditText2.RequestFocus End Sub ********* I have used the above code and what I get is focus going to EditText4 - which is a text field below EditText1... and not EditText2 which is to the right. As U can see I tried enabling/disabling EditText(?) and that actualy works but is ugly
Ricky D Well-Known Member Licensed User Longtime User Feb 9, 2012 #5 mmm It doesn't work here either I tried a simple one out: this is the screen positions EDITTEXT1 EDITTEXT2 EDITTEXT3 in the EnterPressed event of edittext1 I do editText2.RequestFocus and behold it goes to editText3 the next thing I did was to catch the focus on edittext3 to throw focus to edittext2 and that worked : Code: Sub EditText3_FocusChanged (HasFocus As Boolean) If HasFocus=True Then EditText2.RequestFocus End Sub but the problem with that is when a user touches edittext3 it will jump to edittext2 which is undesirable if you really want edittext3 to get focus When trapping edittext1's EnterPressed we should set a flag Code: Sub Globals Dim FocusGoingTo As String : FocusGoingTo = "" in EnterPressed Code: FocusGoingTo = "edittext2" in edittext3's FocusChanged Code: If HasFocus=True Then If FocusGoingTo="edittext2" Then editText2.RequestFocus End If End If and in edittext2's FocusChanged Code: 'do some stuff FocusGoingTo = "" 'do this as the last thing & allows all views to receive focus That's the only way I can think of doing it. Not knowing much about linux and android in particular I can't say there isn't other ways regards, Ricky Upvote 0
mmm It doesn't work here either I tried a simple one out: this is the screen positions EDITTEXT1 EDITTEXT2 EDITTEXT3 in the EnterPressed event of edittext1 I do editText2.RequestFocus and behold it goes to editText3 the next thing I did was to catch the focus on edittext3 to throw focus to edittext2 and that worked : Code: Sub EditText3_FocusChanged (HasFocus As Boolean) If HasFocus=True Then EditText2.RequestFocus End Sub but the problem with that is when a user touches edittext3 it will jump to edittext2 which is undesirable if you really want edittext3 to get focus When trapping edittext1's EnterPressed we should set a flag Code: Sub Globals Dim FocusGoingTo As String : FocusGoingTo = "" in EnterPressed Code: FocusGoingTo = "edittext2" in edittext3's FocusChanged Code: If HasFocus=True Then If FocusGoingTo="edittext2" Then editText2.RequestFocus End If End If and in edittext2's FocusChanged Code: 'do some stuff FocusGoingTo = "" 'do this as the last thing & allows all views to receive focus That's the only way I can think of doing it. Not knowing much about linux and android in particular I can't say there isn't other ways regards, Ricky
P Pelky Active Member Licensed User Longtime User Feb 9, 2012 #6 Ricky it WORKS!... Thank you that has done the trick.. It must be said that it is not the most elegant way of having to do it. Wouldn't it be nice if the 'order' could be determined at the Design stage? ... Once again I would like to thank you for your assistance.. Upvote 0
Ricky it WORKS!... Thank you that has done the trick.. It must be said that it is not the most elegant way of having to do it. Wouldn't it be nice if the 'order' could be determined at the Design stage? ... Once again I would like to thank you for your assistance..
Ricky D Well-Known Member Licensed User Longtime User Feb 10, 2012 #7 yes it certainly is ugly but then again I used to write code for an ancient cp/m based system (a bulletin board I wrote in Turbo Pascal) that ran on a 64k Microbee with 2 5.25" floppy drives. I had to write some ugly code but in the end if it worked I never minded You should see some of that! omg to be able to embed machine code in your source was way cool of course you needed to know what you were doing exactly to the byte lol. So when I don't know an easier method to do what you need I guess ugly has to be loved (do comment it - you may forget what the heck is going on later! I've done that lol) And YES it would be great if we could change the zorder. Maybe android has it? I don't know. cheers, Ricky Upvote 0
yes it certainly is ugly but then again I used to write code for an ancient cp/m based system (a bulletin board I wrote in Turbo Pascal) that ran on a 64k Microbee with 2 5.25" floppy drives. I had to write some ugly code but in the end if it worked I never minded You should see some of that! omg to be able to embed machine code in your source was way cool of course you needed to know what you were doing exactly to the byte lol. So when I don't know an easier method to do what you need I guess ugly has to be loved (do comment it - you may forget what the heck is going on later! I've done that lol) And YES it would be great if we could change the zorder. Maybe android has it? I don't know. cheers, Ricky
P Pelky Active Member Licensed User Longtime User Feb 10, 2012 #8 Ha Ha ... I used to code in Basic on an old Data General and had very little resource avaialbe so had to do a lot of machine code to enable fancy screens... I also had to create my own libraries as I was lazy and didnt want to recode.... Anyway thanks again and if I find a nicer way I will get back to you.. Upvote 0
Ha Ha ... I used to code in Basic on an old Data General and had very little resource avaialbe so had to do a lot of machine code to enable fancy screens... I also had to create my own libraries as I was lazy and didnt want to recode.... Anyway thanks again and if I find a nicer way I will get back to you..