Android Question canvas question

DPaul

Active Member
Licensed User
Longtime User
Hi,

Recently i have been dabbling with graphics, and wow, they are stunning !
Except for one little inconvenience that i cannot explain.
Setup:
- "Bigpanel" at bottom of tablet.
- on bigpanel: a set of small panels with radio buttons, user picks what he wants to see.
- Also on "bigpanel" a square panel = the canvas.
To trigger the graph, there is a button "show" (inside bigpanel),
that does a database call and produces the graph...
...But not immediately, in fact nothing happens...
...until i touch some other control (view) outside the "big panel".
Then the graph apprears. Magic!
Surely i'm missing something.

(Also i find the procedure to erase the canvas somewhat cumbersome. Can't we do "canvas.erase" or something?)

thx,
paul
 

DonManfred

Expert
Licensed User
Longtime User
We now should GUESS the code you are using?
 
Upvote 0

DPaul

Active Member
Licensed User
Longtime User
I agree with DonManfred, you shouls show us your code.
Do you use Panel.Invalidate after drawing?

Well, there is only one line, the "drawline" statement. Whether i do 1 or a 100, makes no difference.
But Klaus is right, i did not invalidate.
As i was reading the beginner's guide, chapter 16.2.1.2 "draw a line", that was all i needed to construct my graphs.
The invalidate is mentioned in the introduction of the chapter, but not in the drawline sample.
For completenes sake, it might be an idea to add this. Now i see that it is written in some of the more exotic samples.
By the way, in §16.2.1.2, somebody forgot to close the brackets after "3dip". :)

Thanks
Paul
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
By the way, in §16.2.1.2, somebody forgot to close the brackets after "3dip".
Thank you for reporting it, amended for the next edition.
The invalidation is not needed after each drawing instruction but only when you want the view you draw on beeing redrawn.
Mentioning the invalidation in each chapter for the basic function might be confusing.
I added the Invalidate functions in the Overview chapter.
 
Upvote 0
Top