|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Topic # 1467 |
pushbutton text bug? |
26/10/2006 @ 01:24 by Dave O\'Brien
|
Hi there, me again.
I'm working on a little "mine sweeper" game in iziBasic, and I've run into a strange behavior that I can't figure out.
I'm using a 12x12 grid of pushbuttons. When the user clicks on a cell, it reveals the # of mines in the 8 cells around it.
Here's the weird part - on pen down, the pushbutton's text sometimes changes to the previously tapped pushbutton's text. I don't think there's a way to capture the pen-down event for a control, so maybe it's something in iziBasic or PP, or perhaps even the Palm OS itself.
I reproduced this on a TX (color) and an old Visor Platinum (monochrome) - same behavior.
I'll try to post some sample code, but I thought I'd tell you in the meantime.
For now, I'm working around this by updating the pushbutton's text from the underlying variable each time it's clicked. Good enough for now.
Thanks for any help. |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1 -------- 26/10/2006 @ 20:44 by Dave O\'Brien
visitor |
Fooled around some more, and there's another behavior which may (or may not) be related:
The UPDATETEXT function seems to interfere with the rendering of the pushbutton's on/off state.
For example, this code:
UPDATETEXT #1, "Test" UPDATEVALUE #1, 1
...seems to give a different appearance than the reverse order:
UPDATEVALUE #1, 1 UPDATETEXT #1, "Test"
Seems to me that the text and value should not affect each other.
Will debug this some more and post some actual code that reproduces it.
Thanks.
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2 -------- 27/10/2006 @ 02:09 by aldweb
visitor |
Hello Dave,
Reading you makes me believe that there could be some kind of a "memory leak" somewhere in the data storing of the objects in iziBasic's virtual machine, when using lots of PUSHBUTTONs... To be investigated on my side.
Nevertheless, why use so many PUSHBUTTONs for that kind of game? Why not use instead some kind of virtual grid made of images (or text) put one next to the other and then capture only one event, a pendown event, find from the X,Y returned values which cell in the grid was selected and have your program react accordingly? This way of doing should be much faster, less resources consuming and your source code should also be a little bit smaller.
Cheers, aldweb
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 3 -------- 27/10/2006 @ 07:41 by Dave O\'Brien
visitor |
My answer: because it was "izi" to use pushbuttons. ;^)
The pushbutton does what I want: - it's rectangular(unlike a button) - it has a settable label - it stores state (on/off) - it responds to tap events
But yes, it's a hog on resources. I would eventually like to use images instead, but I wanted to get the basic logic working first, then swap out the pushbuttons later. Iterative development, don't you know. :D
Thanks for any help. |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 4 -------- 31/10/2006 @ 10:48 by aldweb
visitor |
Hello Dave,
Would you accept to send me your source code so that I can try to figure out where the issue is in iziBasic's memory management for objects? (of course, as always, I guarantee full confidentiality and I will delete your source code from my device, my e-mail, my hard disk when the needed tests will be finished).
Cheers,
@+ aldweb |
|
|
topic active
topic closed
Sticky
New message -
Correct message
Close topic
Make sticky
|
|