partial screen update

anuj0sharma

Member
Licensed User
Longtime User
:sign0085:
Hello there,
i m working on an application in wich i am loading an image in upper half of the screen. the lower half has some buttons. i've kept 4 transparent buttons on the image to sense the touch on different area of the image. now based on the button touch i m replacing the image with a new image. this is done using the panels.

while loading the second panel, the image portion gets loaded correctly but the lower portion of the screen becomes black. i want this lower half to be always there irrespective of any image load and unload on top half.

basically, i m trying to use the layers/planes concept of TFT, where only the targeted area is changed and rest area is static. how to do this using b4a.

any example would be greatly appreciated as i m starting with android app dev.
attaching my code snippet for reference.

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   
   Dim pnl1stLayout As Panel 
   Dim pnl2ndLayout As Panel 
End Sub

Sub Activity_Create(FirstTime As Boolean)
   pnl1stLayout.Initialize("")
   pnl2ndLayout.Initialize("")
   
   Activity.AddView(pnl1stLayout,0,0,800,480)
   pnl1stLayout.LoadLayout("plantArea")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub btnExit_Click
   Activity.Finish
End Sub

Sub btnRed_Click
   pnl1stLayout.RemoveView 
   Activity.AddView(pnl2ndLayout,200,0,600,300)
   pnl2ndLayout.LoadLayout("redArea")
End Sub

Sub btnBack_Click
   pnl2ndLayout.RemoveView 
   Activity.AddView(pnl1stLayout,0,0,800,480)
   pnl1stLayout.LoadLayout("plantArea")
End Sub

i guess someone would have come across simillar situlation..
thanks in advance.
 

klaus

Expert
Licensed User
Longtime User
You have several options to do this:
1) have only one layout with all your buttons on the Activity
and draw the images onto the activitie's background.
2) have only one layout with all your buttons on the Activity
and an imageview for the images.
3) have one panel for the buttons wich remains always visible no need to remove it, and one panel or an imageview for the images.

Best regards.
 
Upvote 0

anuj0sharma

Member
Licensed User
Longtime User
thanks for the multiple options Klaus;
well.i m not so gud at using b4a options so well..will surely try all the possibilities suggested by you. meanwhile if someone can find some simillar example, please do post.
thanks for the helping hand.
 
Upvote 0
Top