Johan Schoeman Expert Licensed User Longtime User Oct 16, 2020 #1 I have an Imageview inside and Expandable Listview: This line of code gets the applicable panel in the ListView B4X: Dim pnlItems As B4XView = clv1.GetPanel(index).GetView(1) This line of code gets the ImageView in the expandable listview B4X: pnlItems.GetView(0).SetBitmap(lastPicture) How can I force a redraw (Invalidate) of the bitmap loaded into the Imageview? There seems to be no Invalidate method to force a redraw? Thanks JS
I have an Imageview inside and Expandable Listview: This line of code gets the applicable panel in the ListView B4X: Dim pnlItems As B4XView = clv1.GetPanel(index).GetView(1) This line of code gets the ImageView in the expandable listview B4X: pnlItems.GetView(0).SetBitmap(lastPicture) How can I force a redraw (Invalidate) of the bitmap loaded into the Imageview? There seems to be no Invalidate method to force a redraw? Thanks JS
LucaMs Expert Licensed User Longtime User Oct 16, 2020 #2 Johan Schoeman said: Dim pnlItems As B4XView = clv1.GetPanel(index).GetView(1) Click to expand... This should return your ImageView, I think, not the item panel. Try: B4X: Private Sub clv1_ItemClick (Index As Int, Value As Object) Dim iv As B4XView = clv1.GetPanel(Index).GetView(1) iv.SetBitmap(lastPicture) End Sub EDIT: you're talking about Expandable CLV; sorry, I tried a simple xCLV. Is it the same? Currently don't know Last edited: Oct 16, 2020 Upvote 0
Johan Schoeman said: Dim pnlItems As B4XView = clv1.GetPanel(index).GetView(1) Click to expand... This should return your ImageView, I think, not the item panel. Try: B4X: Private Sub clv1_ItemClick (Index As Int, Value As Object) Dim iv As B4XView = clv1.GetPanel(Index).GetView(1) iv.SetBitmap(lastPicture) End Sub EDIT: you're talking about Expandable CLV; sorry, I tried a simple xCLV. Is it the same? Currently don't know
LucaMs Expert Licensed User Longtime User Oct 16, 2020 #3 Struggling but I did it. B4X: Sub clv1_ItemClick (Index As Int, Value As Object) expandable.ToggleItem(Index) Sleep(clv1.AnimationDuration + 20) ' <--- Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) dim iv as B4XView = pnl.GetView(0) iv.SetBitmap(lastPicture) End Sub I have used and modified Erel's example (attached). Attachments B4A_ExpandableList_Changed.zip B4A_ExpandableList_Changed.zip 14.8 KB · Views: 357 Upvote 0
Struggling but I did it. B4X: Sub clv1_ItemClick (Index As Int, Value As Object) expandable.ToggleItem(Index) Sleep(clv1.AnimationDuration + 20) ' <--- Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) dim iv as B4XView = pnl.GetView(0) iv.SetBitmap(lastPicture) End Sub I have used and modified Erel's example (attached).
Johan Schoeman Expert Licensed User Longtime User Oct 17, 2020 #4 LucaMs said: Struggling but I did it. B4X: Sub clv1_ItemClick (Index As Int, Value As Object) expandable.ToggleItem(Index) Sleep(clv1.AnimationDuration + 20) ' <--- Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) dim iv as B4XView = pnl.GetView(0) iv.SetBitmap(lastPicture) End Sub I have used and modified Erel's example (attached). Click to expand... My code above does set the Bitmap but I need to then do a redraw and there is not a Invalidate method to do so...... Upvote 0
LucaMs said: Struggling but I did it. B4X: Sub clv1_ItemClick (Index As Int, Value As Object) expandable.ToggleItem(Index) Sleep(clv1.AnimationDuration + 20) ' <--- Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) dim iv as B4XView = pnl.GetView(0) iv.SetBitmap(lastPicture) End Sub I have used and modified Erel's example (attached). Click to expand... My code above does set the Bitmap but I need to then do a redraw and there is not a Invalidate method to do so......
mangojack Expert Licensed User Longtime User Oct 17, 2020 #5 In this case declare the view as ImageView .. not B4XView Code: Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) dim iv as ImageView = pnl.GetView(0) iv.Bitmap = LastPicture iv.Invalidate ... As a side note ... If you declare the panel as B4XView , you can reference the child b4xView's properties without explicitly declaring them ie: (Refer post #3) Code: Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) pnl.GetView(0).SetBitmap(lastPicture) Last edited: Oct 17, 2020 Upvote 0
In this case declare the view as ImageView .. not B4XView Code: Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) dim iv as ImageView = pnl.GetView(0) iv.Bitmap = LastPicture iv.Invalidate ... As a side note ... If you declare the panel as B4XView , you can reference the child b4xView's properties without explicitly declaring them ie: (Refer post #3) Code: Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) pnl.GetView(0).SetBitmap(lastPicture)
Johan Schoeman Expert Licensed User Longtime User Oct 17, 2020 #6 mangojack said: In this case declare the view as ImageView .. not B4XView Code: Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) dim iv as ImageView = pnl.GetView(0) iv.Bitmap = LastPicture iv.Invalidate ... Click to expand... It does not invalidate (redraw) the bitmap in the ImageView that is located at pnl.GetView(0). When I close the app and then open the app again the image displays correctly. But without closing the app the bitmap does not fit the ImageView. Upvote 0
mangojack said: In this case declare the view as ImageView .. not B4XView Code: Dim pnl As B4XView = clv1.GetPanel(Index).GetView(1) dim iv as ImageView = pnl.GetView(0) iv.Bitmap = LastPicture iv.Invalidate ... Click to expand... It does not invalidate (redraw) the bitmap in the ImageView that is located at pnl.GetView(0). When I close the app and then open the app again the image displays correctly. But without closing the app the bitmap does not fit the ImageView.
Erel B4X founder Staff member Licensed User Longtime User Oct 18, 2020 #7 You never need to invalidate or redraw an ImageView. If it doesn't show the "correct" image then the problem is somewhere else. Maybe there are multiple stacked ImageViews. Upvote 0
You never need to invalidate or redraw an ImageView. If it doesn't show the "correct" image then the problem is somewhere else. Maybe there are multiple stacked ImageViews.