Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
raclausi
Posts: 10
Registered: ‎03-10-2013
My Device: playbook, BOLD 9780, Z10
Accepted Solution

writing to textarea sometimes changes the colour of the number (200-999) being written if format %8.4f is used...

Here is a strange problem…esp. since this is the last stage in competing my app and this problem cropped up during field testing.... Depending on the format of the %float, the result2(below) is blue or black… the key is in the number of decimals requested…

Values are double.. then converted to a float… simple arithmetic, here..

..the problem goes away if result2 is printed as %8.3f…else %8.4 and %10.4 produce a BLUE output of 307.9890 …hmmmmm…gremlins…???? Here is the offending code…

 

P=679;

U=1;

 

result = float(p/u);

result2= float(result*453.592);

  sprintf(myline,"->[#%3.0d]\n $%8.3f for %8.3f   \n$%8.4f  or %8.4f \n\n",entryline,p,u,result,result2);

 

// let us see what it looks like... in various formats..

sprintf(myline," scan...% 8.3f   %8.4f  %10.3f %10.4f",result2,result2,result2,result2);

fprintf(stderr," scan...% 8.3f   %8.4f  %10.3f %10.4f",result2,result2,result2,result2);

 

displayIt();  yes… black .. blue… black .. blue…in the textarea and

 

stderr on console looks like this…

scan... 307.989   307.9890     307.989   307.9890

 

%10.4f also generates a BLUE number result if the result2 is in the range inclusive 200-999…

 

Here are the lines leading up to it….. should toUtf8 be toAscii ???? no effect!!

The eventual fate of thisline is to be written to a textArea in a function elsewhere..the  line is included here for reference.. is there  a memory leak???

------------------------------------------------------

 

QByteArray byteArray=minput2->text().toUtf8();

//QByteArray byteArray=minput2->text().toAscii();

 

              strcpy(thisline,byteArray.constData());

textArea->setText(thisline);

 

              price=atof(thisline);

 

              byteArray=minput3->text().toUtf8();

                    strcpy(thisline,byteArray.constData());

                    units=atof(thisline);

 

textArea->setText(thisline);

 

 

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: writing to textarea sometimes changes the colour of the number (200-999) being written if format %8.4f is used...

Should this have been posted in the Cascades forum? I don't know what "textArea" would be in the context of a non-Cascades native app.

If it's Cascades, or at least if it's using some system-provided control to display the text, my guess is you're encountering some "auto-text" which is marking what it thinks are phone numbers, and presumably if you were to tap on them it might also attempt to invoke the Phone app to dial them.

If it's Cascades, you can also use the various properties of the control involved to turn off this default behaviour.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
raclausi
Posts: 10
Registered: ‎03-10-2013
My Device: playbook, BOLD 9780, Z10

Re: writing to textarea sometimes changes the colour of the number (200-999) being written if format %8.4f is used...

Peter.. thank you for your quick, and accurate, response. Indeed, if I tap the number, it does try to dial... THANK YOU... I have had this dev alpha for almost 2 weeks, and I am programming in C++ to access Cascades contols/widgets.... It has been a steep learning curve esp. wrt QT... I will have to find the property to turn off this "feature".... unless I make this a "dial someone randomly in the world" app...errrr, no..not a good idea,eh.... do you know off hand what the property is.... by the way, am i niaive in assuming that "native app" means "written in C++"???? I seem to have heard that comment at the Waterloo BB Jam in Sept.... cheers, rich clausi, waterloo

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: writing to textarea sometimes changes the colour of the number (200-999) being written if format %8.4f is used...

Native does mean "written in C++" but around here with the added qualification "and not using the Cascades framework", since there's a forum specifically for that. I'll click on the "Report Inappropriate Content" to request that a moderator move it, since that's the best way to handle such cases.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
raclausi
Posts: 10
Registered: ‎03-10-2013
My Device: playbook, BOLD 9780, Z10

Re: writing to textarea sometimes changes the colour of the number (200-999) being written if format %8.4f is used...

Thank You, Peter, for the solution, and redirection of the posting.... by the way, i decided that i do not need 4 decimals so since 3 keeps the interface from thinking it is a telephone number,  I am a happy camper...  I would NEVER have figured that dialer bit out...cheers, rich