Crash with gets() and PToolbox

A PocketC native palm library offering native forms and assorted utilities

Postby Percival on Sat Jul 19, 2003 10:40 am

Hi,

I have a problem with methods like gets and getsd. If you exit the app after a form is drawn and the gets dialog is popped up, the palm will crash and a soft reset is needed. With exiting the app, I mean pressing home or any hardkey.

Here is an example:

//CrashingTest
library "PToolboxLib"
include "Fctl.h"

main() {
int e;
graph_on();
Form(5000,"Title");
Fctl(DRAW,5000);
gets("Test input");
while(1) {
e = Fevent(1);
}
}

Am I doing something wrong?
Percival
 
Posts: 45
Joined: Sat Jul 19, 2003 10:31 am
Location: Netherlands

Postby jstadolnik on Sat Jul 19, 2003 12:40 pm

There is nothing I can do remedy this, PocketC is in control of the gets() and doesn't know how to return to the correct form.

However, you easily get around this problem altogether by crafting your own dialogs with the Dialog() function or by creating a resource dialog form. This will also give you complete control of the dialog form anyhow (e.g. size, title, buttons, scrollbar, etc).

Also, it's not desirable to use any of PocketC's dialog type functions when using PToolbox forms because they can steal events.

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
From the caveats sub-section of the Form section in the PToolbox docs.

14. Some built-in PocketC commands, notably the Basic I/O functions (puts, gets, setsd, getsi, setsm, alert, confirm, and clear), can "eat" button, list, and resource menu events.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA


Return to Pocket Toolbox

Who is online

Users browsing this forum: No registered users and 2 guests

cron