B4J Question [BANano] SKcombo - unable to clear the view [Solved]

Dave G

Active Member
Licensed User
There does not appear to be a .clear method so can't clear it out. Looked at SKcombo.bas for b4xlib didn't see one. Also, how do I use Initialize for SKcombo? Thanks.
 
Solution
Well, I created the PWA and added in code a little at a time, replaced WelcomePageLayout.bjl with one I've created and it worked! Then I created another PWA, replaced WelcomePageLayout.bjl with one I've created. Then copied and pasted all of the code from my project that had the issue with Password Type into the new PWA and it worked! So, there is something buried in my b4j project that caused the problem, but not my code or layout. Bizarre. Onward. Now to try to get SQLite working instead of Sql Server, without the connection pool in my server.

Thanks all

alwaysbusy

Expert
Licensed User
Longtime User
You can try doing it by accessing the element:

B4X:
cmb.Element.Empty

Initialize example:
B4X:
Dim body As BANanoElement
body.Initialize("body")
    
 ' some div where we can attach the combo to
body.Append($"<div id="mydiv"></div>"$)

' create the combo    
Dim cmb As SKCombo
cmb.Initialize(Me, "cmb", "cmb")
' add to the mydiv tag    
cmb.AddToParent("mydiv")
' add some options    
cmb.AddOption("1", "Option 1")
cmb.AddOption("2", "Option 2")
...

' event
Sub cmb_Change (event As BANanoEvent)
    Dim cmb As SKCombo = Sender
    ' do something with cmb
   ...
End Sub

Alwaysbusy
 
Upvote 0

Dave G

Active Member
Licensed User
You can try doing it by accessing the element:

B4X:
cmb.Element.Empty

Initialize example:
B4X:
Dim body As BANanoElement
body.Initialize("body")
   
 ' some div where we can attach the combo to
body.Append($"<div id="mydiv"></div>"$)

' create the combo   
Dim cmb As SKCombo
cmb.Initialize(Me, "cmb", "cmb")
' add to the mydiv tag   
cmb.AddToParent("mydiv")
' add some options   
cmb.AddOption("1", "Option 1")
cmb.AddOption("2", "Option 2")
...

' event
Sub cmb_Change (event As BANanoEvent)
    Dim cmb As SKCombo = Sender
    ' do something with cmb
   ...
End Sub

Alwaysbusy
Thanks. Will give it a try today and let you know either way.
 
Upvote 0

Dave G

Active Member
Licensed User
Sorry for the delay. Switched to new Internet provider and it hasn't gone well. I can't do a live test because me IPs are assigned by router until I get a better router. So, here's where I'm at. I incorporated your suggestions and it worked partially. I test retest until I find a router that works with my new cable modem.

The statement cmbOrders.Enabled = True caused the exception!

Will provide details when possible.
 
Upvote 0

Dave G

Active Member
Licensed User
Okay. Got my development machine working on the Internet.

Here's the exception from:

cmbOrders.Enabled = True causes exception:
                    Log("ORDHDR")
                    tblDataORDHDR.Put(valuePieces(0) & "|" & valuePieces(1), dataMap)
                    cmbOrders.AddOption(valuePieces(0) & " " & valuePieces(1), valuePieces(0) & " " & valuePieces(1))
                    Log("AddOption Complete")
                    cmbOrders.Enabled = True
                    Log("Enabled Complete")

cmbOrders.Enabled = True
causes:
B4X:
app1659284970915.js:8 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'removeAttribute')
    at _B.setenabled (app1659284970915.js:8:23157)
    at _B.setenabled (app1659284970915.js:8:4370)
    at app1659284970915.js:10:3760

In addition the cmbOrders.AddOption(valuePieces(0) & " " & valuePieces(1), valuePieces(0) & " " & valuePieces(1)) doesn't work (did work before changes)
 
Upvote 0

Dave G

Active Member
Licensed User
BTW, if I comment out the following it goes back to working.

B4X:
    'cmbOrders.Initialize(Me, "cmbOrders", "cmbOrders")
    'cmbOrders.AddToParent("mainHolder")
 
Upvote 0

Dave G

Active Member
Licensed User
Update - if I omit the following
B4X:
cmbOrders.Initialize(Me, "cmbOrders", "cmbOrders")
cmbOrders.AddToParent("mainHolder")
it works! .empty works!

thanks
 
Last edited:
Upvote 0

Dave G

Active Member
Licensed User
Update 2 - changing a SKTextBox to Type of password causes the app to loop of errors and an icon to appear in the two SKTextBoxes! If I set the SKTextBox back to Type of text the errors and icons go away! The good news is that
cmbOrders.Initialize(Me, "cmbOrders", "cmbOrders")
allows me to use the .hide method.

B4X:
vTools failed to load source map: Could not load content for chrome-extension://gjfpmkejnolcfklaaddjnckanhhgegla/permissionProxyInjector.bundle.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
The FetchEvent for "chrome-extension://gjfpmkejnolcfklaaddjnckanhhgegla/permissionProxyDisabled.bundle.js" resulted in a network error response: the promise was rejected.
Promise.then (async)
(anonymous) @ service-worker.js:1
service-worker.js:1 Uncaught (in promise) TypeError: Failed to execute 'put' on 'Cache': Request scheme 'chrome-extension' is unsupported
    at service-worker.js:1:2560
(anonymous) @ service-worker.js:1
VM846 permissionProxyInjector.bundle.js:1          GET chrome-extension://gjfpmkejnolcfklaaddjnckanhhgegla/permissionProxyDisabled.bundle.js net::ERR_FAILED
n @ VM846 permissionProxyInjector.bundle.js:1
(anonymous) @ VM846 permissionProxyInjector.bundle.js:1
s @ VM846 permissionProxyInjector.bundle.js:1
(anonymous) @ VM846 permissionProxyInjector.bundle.js:1
t.<computed> @ VM846 permissionProxyInjector.bundle.js:1
r @ VM846 permissionProxyInjector.bundle.js:1
c @ VM846 permissionProxyInjector.bundle.js:1
Promise.then (async)
r @ VM846 permissionProxyInjector.bundle.js:1
c @ VM846 permissionProxyInjector.bundle.js:1
(anonymous) @ VM846 permissionProxyInjector.bundle.js:1
(anonymous) @ VM846 permissionProxyInjector.bundle.js:1
(anonymous) @ VM846 permissionProxyInjector.bundle.js:1
607 @ VM846 permissionProxyInjector.bundle.js:1
r @ VM846 permissionProxyInjector.bundle.js:1
(anonymous) @ VM846 permissionProxyInjector.bundle.js:1
(anonymous) @ VM846 permissionProxyInjector.bundle.js:1
DevTools failed to load source map: Could not load content for chrome-extension://gjfpmkejnolcfklaaddjnckanhhgegla/permissionProxyInjector.bundle.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
 
Upvote 0

Toky Olivier

Active Member
Licensed User
Longtime User
I think that that it's better that you need to reproduce your error in a sample/simple project and send us and we'll how to help.
It's easier like that.
 
Upvote 0

Dave G

Active Member
Licensed User
I think that that it's better that you need to reproduce your error in a sample/simple project and send us and we'll how to help.
It's easier like that.
I'll try. I've been working on this app off and on for a couple of months and it's over 400 lines now. Until I tried to change the TextBox Type to password it been fine.

I created a BANano PWA and added in my layout with the txtBox, but it works without all of the surrounding code. I'll see if I can add in code a little at a time to see if I can break it.

Thanks.
 
Upvote 0

Dave G

Active Member
Licensed User
Well, I created the PWA and added in code a little at a time, replaced WelcomePageLayout.bjl with one I've created and it worked! Then I created another PWA, replaced WelcomePageLayout.bjl with one I've created. Then copied and pasted all of the code from my project that had the issue with Password Type into the new PWA and it worked! So, there is something buried in my b4j project that caused the problem, but not my code or layout. Bizarre. Onward. Now to try to get SQLite working instead of Sql Server, without the connection pool in my server.

Thanks all
 
Last edited:
Upvote 0
Solution

Dave G

Active Member
Licensed User
Well, I created the PWA and added in code a little at a time, replaced WelcomePageLayout.bjl with one I've created and it worked! Then I created another PWA, replaced WelcomePageLayout.bjl with one I've created. Then copied and pasted all of the code from my project that had the issue with Password Type into the new PWA and it worked! So, there is something buried in my b4j project that caused the problem, but not my code or layout. Bizarre. Onward. Now to try to get SQLite working instead of Sql Server, without the connection pool in my server.

Thanks all
Finally figured out the cause of issues with a SKTextBox Type of password. I was re-reading BANano B4X Getting Started and ran across "19.2 Web App doesn't update after recompiling" and Service Workers being registered. So, I unregistered the Server Worker associated with my PWA client, invoked the URL and it work! The issues is that Type of password causes the browser to initiate an interaction with password managers such as Norton to retrieve the username/password. In addition, it displays a little icon (see attachment) when it works, but a bogus icon and repeated attempts to retrieve the correct icon. So, wasn't my code or BANano after all, just an over zealous browser.
 

Attachments

  • passworIcons.jpg
    passworIcons.jpg
    8.8 KB · Views: 77
Upvote 0
Top