Page 1 of 1

PostPosted: Tue Jun 22, 2004 8:07 pm
by deadserious
Here are 2 nearly identical handlers. The first causes garbage to display in the alert. The second displays correctly. LocationData and LocationNamesFull are both stringlists. The problem occurs on real palm devices and on the emulator and simulator.

handler lstRooms.onselect() {
UIList lst;
lst = this;

handler lstRooms.onselect() {
UIList lst;
string s = "";
lst = this;
s = LocationData.item(LocationNamesFull.find(lst.gettext(lst.selitem)));

PostPosted: Wed Jun 23, 2004 6:39 am
by nmc
Read the docs: "Do not create UIList objects manually."
Instead, use a pointer: UIList *lst = this;"

PostPosted: Wed Jun 23, 2004 10:09 am
by deadserious
Sorry, that was a result of playing around to try to fix the problem. The following still causes garbage.

handler lstRooms.onselect() {
UIList* lst;
string s = "";
lst = &this;

PostPosted: Wed Jun 23, 2004 7:08 pm
by nmc
Any changes after replacing "lst->" by "this."?
Try to split your statement into smaller ones to determine the reason for the garbage.

PostPosted: Wed Jun 23, 2004 8:16 pm
by deadserious
No change.

But did you see the difference between the one that worked and the one that didn't???

The only difference is that I'm assigning the value to a string first before passing it into alertc().

FWIW, there is no garbage when passing it into alert() instead.

PostPosted: Sun Oct 30, 2005 12:36 am
by Cyplesma
I got the same problem with garbage in an alertc.

in fact I've got two alertc one doesn't give me any problems the other one actually changes the garbage it displays. and finally on the third time displayed it shows what it's supposed to.

I do use a variable in the alertc statement in the message section, but that variable is a string.

any ideas?

even if I don't use any variables in the second alertc all the options except last (alertQuestion) both are alertQuestions, i still get the garbage on the second alertQuestion.

PostPosted: Sun Oct 30, 2005 7:58 pm
by dewey
This is a bug in the alertc and promptc functions. They are improperly releasing the string before displaying it, which only sometimes causes a problem. The reason the second form works is that the string is being copied to a local variable, rather than just being put on the stack. Since it is a local (and strings are internally ref-counted/copy-on-write), the string will not be freed until the function exits. This is fixed in the current dev tree, which will be in v4.0 in a couple months.

PostPosted: Thu Mar 09, 2006 5:55 pm
by danypoup
Indeed, it seems that this problem is not solved by OrbForms Designer 4.01. I've got this problem with alertc function : the only workaround was to put the message string in a variable and pass it to alertc function.
Example :
This one doesn't work, it generates garbage characters :

<font face="Courier New">alertc("About", "My app.\nVersion " + myapp.version, "OK", alertInfo);</font id="Courier New">

whereas this works :

<font face="Courier New">string strMessage = "My app.\nVersion " + myapp.version;
alertc("A propos de", strMessage, "OK", alertInfo);</font id="Courier New">

Compiled with OrbForms Designer 4.01 and tested under Palm Simulator 5.4.


PostPosted: Tue Mar 14, 2006 3:29 am
by dewey
I'll take another look at this. It looks like there must have been two issues.

PostPosted: Wed Jun 21, 2006 5:38 am
by Rudi
Sometimes i get also garbage with 4.0.1 when

i define a string with "add string" in the IDE:
Text=foobar test

and know:

a normal alert(strtest) and the alertc() display garbage.

But, its not easy to testing it, because small apps never display garbage, but apps with 100 string, 30 forms and tons of functions sooner or later you get garbage.
My Workarround is: Never use the IDE strings and also no normal defined string, i use if possible always the direct string
alert("bla bla foobaar")


PostPosted: Fri Jun 23, 2006 2:30 am
by dewey
I will get this fixed for 4.1.