B4J Question [ABMaterial] Flush vs Refresh Page

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

working on my first (simple) ABMaterial HowTo app to switch an LED connected to a Raspberry Pi.
Two buttons are used ON and OFF which enabled state is depending switching.
When clicking button ON, its set to disabled and button OFF set to enabled.
To show in the HTML page, the button state, tested in sub button click:
  • ws.Flush: no button visual update shown
  • page.ws.Flush: no button visual update shown
  • page.Refresh: button visual update is shown
Q: what is the correct way to update the state of a button on a HTML page

Q: Strange behavior when using page.refresh, noticed that the content of a par is replaced by some unknown text. In below example instead of my message, a number from another cell is displayed?
B4X:
 ' row 4
page.AddRows(1,False, "").AddCells12(1,"")
...
Dim msg As String =  "My Message"
page.Cell(4,1).AddComponent(ABMShared.BuildParagraph(page,"par3",msg) )

Attached the early code in progress --- still learning --- the row/cell concept not getting the full understanding ... thinking of a simple addrow(number of cells), like add a row with 4 cells = addrow(4). The cells are then split across the screen 100/4 = 25% wide each ... but ok, its another question.
 

Attachments

  • LEDControl.zip
    11.3 KB · Views: 195

alwaysbusy

Expert
Licensed User
Longtime User
All your components have the same name "par3"

Dim msg As String = "Set the Pin Number 3 = physical pin 15 = GPIO22 = GPIO_GEN3 as GpioPinDigitalOutput{BR}(the GPIO_GEN3 indicates Pin 3)"
page.Cell(4,1).AddComponent(ABMShared.BuildParagraph(page,"par3",msg) )

' row 5 as test
page.Cell(5,1).AddComponent(ABMShared.BuildParagraph(page,"par3", "1") )
page.Cell(5,2).AddComponent(ABMShared.BuildParagraph(page,"par3", "2") )
page.Cell(5,3).AddComponent(ABMShared.BuildParagraph(page,"par3", "3") )
page.Cell(5,4).AddComponent(ABMShared.BuildParagraph(page,"par3", "4") )
page.Cell(5,5).AddComponent(ABMShared.BuildParagraph(page,"par3", "5") )
page.Cell(5,6).AddComponent(ABMShared.BuildParagraph(page,"par3", "6") )
page.Cell(5,7).AddComponent(ABMShared.BuildParagraph(page,"par3", "7") )
page.Cell(5,8).AddComponent(ABMShared.BuildParagraph(page,"par3", "8") )
page.Cell(5,9).AddComponent(ABMShared.BuildParagraph(page,"par3", "9") )
page.Cell(5,10).AddComponent(ABMShared.BuildParagraph(page,"par3", "10") )
page.Cell(5,11).AddComponent(ABMShared.BuildParagraph(page,"par3", "11") )
page.Cell(5,12).AddComponent(ABMShared.BuildParagraph(page,"par3", "12") )

should be:

Dim msg As String = "Set the Pin Number 3 = physical pin 15 = GPIO22 = GPIO_GEN3 as GpioPinDigitalOutput{BR}(the GPIO_GEN3 indicates Pin 3)"
page.Cell(4,1).AddComponent(ABMShared.BuildParagraph(page,"par3",msg) )

' row 5 as test
page.Cell(5,1).AddComponent(ABMShared.BuildParagraph(page,"par4", "1") )
page.Cell(5,2).AddComponent(ABMShared.BuildParagraph(page,"par5", "2") )
...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…