Misterbates Active Member Licensed User Sep 6, 2017 #1 I'm really liking the new iCustomDialog library https://www.b4x.com/android/forum/threads/custom-dialogs-with-icustomdialog-library.83526/ I was wondering if there was a way to control the dialog's vertical position on the display. I'm using it to update a text field and have created a panel with a text field, then displayed it with a title and OK/Cancel buttons. However, when clicking in the text field to adjust the value, the keyboard pops up and obscures the OK/Cancel buttons - worse, in portrait orientation there's no way to dismiss the keyboard. at the moment, I need to either rotate to landscape (to have a keyboard dismiss button show up) or use the workaround posted by Erel of making the panel slightly larger than the text field and capturing the Panel_Click event to ResignFocus from the text field. I'd like to have the dialog show at the top of the display, rather than centered in the middle. Alternatively, would be great if the dialog could be moved up the display once text entry is complete?
I'm really liking the new iCustomDialog library https://www.b4x.com/android/forum/threads/custom-dialogs-with-icustomdialog-library.83526/ I was wondering if there was a way to control the dialog's vertical position on the display. I'm using it to update a text field and have created a panel with a text field, then displayed it with a title and OK/Cancel buttons. However, when clicking in the text field to adjust the value, the keyboard pops up and obscures the OK/Cancel buttons - worse, in portrait orientation there's no way to dismiss the keyboard. at the moment, I need to either rotate to landscape (to have a keyboard dismiss button show up) or use the workaround posted by Erel of making the panel slightly larger than the text field and capturing the Panel_Click event to ResignFocus from the text field. I'd like to have the dialog show at the top of the display, rather than centered in the middle. Alternatively, would be great if the dialog could be moved up the display once text entry is complete?
jahswant Well-Known Member Licensed User Longtime User Sep 6, 2017 #2 Please look at this tutorial or this other one. Either you calc Keyboard or you provide a way to hide it. Upvote 0
Please look at this tutorial or this other one. Either you calc Keyboard or you provide a way to hide it.
Misterbates Active Member Licensed User Sep 6, 2017 #3 jahswani said: Please look at this tutorial or this other one. Either you calc Keyboard or you provide a way to hide it. Click to expand... Thanks for the options! Option 1 looks not possible, since to use it I'd need to be able to reposition the CustomDialog - and that's exactly why I posted my question in the first place Option 2 looks like it may work - I'll investigate adding a keyboard accessory view. Upvote 0
jahswani said: Please look at this tutorial or this other one. Either you calc Keyboard or you provide a way to hide it. Click to expand... Thanks for the options! Option 1 looks not possible, since to use it I'd need to be able to reposition the CustomDialog - and that's exactly why I posted my question in the first place Option 2 looks like it may work - I'll investigate adding a keyboard accessory view.
Misterbates Active Member Licensed User Sep 6, 2017 #4 Some progress, but still issues. I added a keyboard accessory that calls ResignFocus on the textfield to hide the keyboard, but due to the position of the CustomDialog, adding the accessory obscures the textfield - I can hide the keyboard, but now can't see what's being edited! Really, I need a way to move the CustomDialog higher up the display. To show the CustomDialog, I use Code: Dim sf As Object = d.ShowAsync("Title", "Positive", "Cancel", "", false) and looking in the debugger, sf shows Code: Description: <SCLAlertView: 0x15a32c00> . Is there any way I can use NativeObject to move the dialog higher? Upvote 0
Some progress, but still issues. I added a keyboard accessory that calls ResignFocus on the textfield to hide the keyboard, but due to the position of the CustomDialog, adding the accessory obscures the textfield - I can hide the keyboard, but now can't see what's being edited! Really, I need a way to move the CustomDialog higher up the display. To show the CustomDialog, I use Code: Dim sf As Object = d.ShowAsync("Title", "Positive", "Cancel", "", false) and looking in the debugger, sf shows Code: Description: <SCLAlertView: 0x15a32c00> . Is there any way I can use NativeObject to move the dialog higher?
Erel B4X founder Staff member Licensed User Longtime User Sep 7, 2017 #5 You can control the position with this code: Code: Dim sf As Object = TimedDialog.ShowAsync("", "OK", "CANCEL", "", False) Dim no As NativeObject = TimedDialog Dim v As View = no.GetField("alertView").GetField("view") Do While v.Top = 0 Sleep(5) Loop v.Top = 100 Upvote 0
You can control the position with this code: Code: Dim sf As Object = TimedDialog.ShowAsync("", "OK", "CANCEL", "", False) Dim no As NativeObject = TimedDialog Dim v As View = no.GetField("alertView").GetField("view") Do While v.Top = 0 Sleep(5) Loop v.Top = 100