Please download the following code :
http://media.pragprog.com/titles/eband3/code/Sudokuv2/src/org/example/sudoku/PuzzleView.java
In the code,
What initial value does selX and selY take and how? I’m asking this because there is a function call (getRect(selX, selY, selRect))that uses these two variables.. So, basically what values of selX and selY are passed during this function call?
Their initial value will be 0 since no where (in this file at least) is it set to anything else. As far as I can tell from the code you have provided, there is only one place
selXandselYare set.selXandselYare only set when theselect(int x, int y)method is called so I can’t really give you the value for them. This means that the values that are passed into..getRect(selX, selY, selRect)are whatever the lastselectset them to.Without knowing where this method is called and what values are passed into it, it’s hard to answer your question. I did notice however that the select method is called within these methods
So it appears that they are set when the user touches the screen or uses the arrow keys.
You could put a breakpoint in here and check it out for yourself