Android Question B4A webview enabled true/false

drgottjr

Expert
Licensed User
Longtime User
i'm not seeing anything related to this problem: i need to "disable" a webview temporarily. that is, i want it to ignore any touching. i assumed setting webview1.enabled = false would accomplish that. it doesn't; i can still drag the webview page around and tap buttons in it. i don't see any relevant settings in the various webextras libraries or the webview itself, beyond enabled = true/false.

background: i have a scrollable listview in the app which displays over the webview when needed. the listview doesn't occupy the entire screen (it slides out about half way and has a transparent background so the webview behind it is still visible). so long as the user only touches the listview as she flings through it and ultimately touches the selection she wants, everything is fine. but if her finger wanders onto the webview as she flings, the webview responds. i don't want it to until the listview is put away. i thought if i disabled the webview when the listview was visible, it would ignore the errant touches.

admitedly, this might be a poor design choice on my part, and, presumably, i can make the listview full-screen, but since enabled = true/false doesn't seem to do what i thought it was supposed to do, i'm wondering what the setting's purpose is then. and, i'd like to know if there is a way to disable the webview briefly without setting its visibility.

thanks in advance.
-go
 

jazzzzzzz

Active Member
Licensed User
Longtime User
You can put a transperant panel above webview and block click events from webview to your panel.And to enable back webview just remove the panel..This might be an option
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
thanks. i've effectively done the same thing by making the listview full screen. since the background is already transparent, it's like having a panel. as someone once said, million accomplished!
also, i'm guessing that by "block click events from webview to your panel" you mean panel.enable = false. if that would work, i still don't understand why webview.enable = false has no effect. at least no effect that i'm expecting.
- go
 
Upvote 0

jazzzzzzz

Active Member
Licensed User
Longtime User
Blocking click using panel means just put a click event in the panel so touch input will not go to underlying views(to webview in yourcase).

B4X:
Sub Panel1_Click
  
End Sub
 
Upvote 0

jazzzzzzz

Active Member
Licensed User
Longtime User
Run this sample project. you can click only the panel.

If you remove this code or remove the panel in runtime
B4X:
Sub Panel1_Click

End Sub
then you can click button through panel
 

Attachments

  • test.zip
    359.1 KB · Views: 252
Upvote 0
Top