|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Sujet n° 1618 |
How to stop time out of the handheld? |
le 17/07/2008 @ 11:29 par Gary
|
How do you stop the handheld from stopping a program after 3 minutes.
I wrote a timer program that counts down to zero, but if I set it to count down to zero from ten minutes the palm shuts down after 3 Min's and stops the programs execution before it can end properly.
Is there a way to let the screen black out, but leave the program running until if finishes?
Thanks Gary |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1 -------- le 18/07/2008 @ 22:51 par aldweb
visiteur |
Hello Gary,
To modify the device's default auto-off delay to more than 3 minutes, you will have to call a Palm OS API function, which is something that can easily be coded using a PP applet. The API function to use is SysSetAutoOffTime() which is described as follows:
Purpose: Set the time out value in seconds for auto-power-off. Zero means never power off. Prototype: UInt16 SysSetAutoOffTime (UInt16 seconds) Parameters: seconds Time out in seconds, or 0 for no time out. Result: Returns previous value of time out in seconds.
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3 -------- le 20/07/2008 @ 14:52 par JoeV
visiteur |
Hello Gary,
Aldweb has written some good tutorials on PP at www.ppcompiler.org. This is how I got started.
I also ran into the same problem, the palm timing out. So I wrote some pp code to change the timeout time. From Izibasic, insert the statement:
r$=CALLPP(160,"0")
to disable the shutdown time.
Here is the pp code:
{ 8-Apr-2007
This applet will allow the caller to change the auto off time of the palm.
Call the applet from izibasic using the format: R$=CALLPP(160,S$) where S$ is the new off time in seconds. R$ returns the previous auto off time in seconds.
}
{$code appl,JVxx,code,160} //required by iziBasic program ppcall160;
{$i PalmAPI.pas} type iBasFunType=function(S:string):string; //required by iziBasic var iBasCallPP:iBasFunType; //required by iziBasic
function SysSetAutoOffTime(sec:UInt16):Uint16;inline(SYSTRAP,$A0c0);
function CallPP(S:string):string; var s1:string; timeo,lto:Uint16; begin timeo:=stratoi(s); lto:=SysSetAutoOffTime(timeo); //set new auto off time stritoa(s1,lto); callpp:=s1; //return with old off time
end;
//Main. Required by iziBasic begin iBasCallPP:=CallPP;
end. Hope this helps. Good luck.
JoeV
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 4 -------- le 20/07/2008 @ 16:36 par Gary
visiteur |
Thanks Joe, I'll have a look at the tutorials and your code.
I found some free ware programs that do what I want, but it would be better to have something written in the code. The problem with a free ware program is that it disables auto shut off for all programs. I only need it to disable my timer program.
I never programed in pp, but I never programed in iziBasic either and I've gotten the hang of it
Thanks again Gary |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 5 -------- le 20/07/2008 @ 19:55 par JoeV
visiteur |
Hello again Gary,
I recommend learning both PP and the palm API calls. Then you can do anything the palm is capable of doing. I learned it and I am not a programmer.
Once you disect my applet code you will find that it is extremely simple. My code returns the current timeout so that you can restore it before you exit your program.
Take care and good luck.
JoeV |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 6 -------- le 04/08/2008 @ 03:55 par Gary
visiteur |
I tried your code and I am having a problem getting it to work.
I Built the pp code that you posted and it was created.
Here is some code from my program.
BEGIN R$=CALLPP$(160,"0") MENU 800 R=COLOR(0) GOSUB _OnAppStart GOSUB _GenerateGUI GOSUB _EventsLoop GOSUB _OnAppExit END
_OnAppExit: R$=CALLPP$(160,R$) RETURN
I have the handheld set to auto-off at 30 seconds
After running the program it shuts down at 30 seconds.
Am I calling it wrong or is it not seeing the pp code?
When I get it working will the pp code be part of the stand-alone PRC?
Thanks Gary |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 7 -------- le 04/08/2008 @ 06:04 par Gary
visiteur |
I forgot to mention that I changed the program from this:
{$code appl,JVxx,code,160} //required by iziBasic program ppcall160;
To this:
{$code appl,tImr,code,160} //required by iziBasic program Timer;
tImr is the creator ID from my timer program and Timer is the name of the program.
The izibasic file is called Timer.ibas, but when I tried to build the pp code it said the PRC was not created. when I used Timer which is the name of the PRC it then created the PRC.
Thanks Gary
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 8 -------- le 05/08/2008 @ 18:50 par JoeV
visiteur |
Hello Gary,
After your first callpp$, R$ should return the current timeout in seconds. In your case, that would be 30. Print R$ and see.
Yes, the pp code will be part of your final compiled app. To check for this, look at your compiled Izibasic program with a resource editor like Bird. Your program should contain the resource "code 160", indicating that the applet is compiled and included in your app.
Hope this helps.
JoeV
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 9 -------- le 06/08/2008 @ 08:53 par Gary
visiteur |
Joe, thanks for getting back, but I am still having some trouble finding the problem.
Your code will compile as written, but when I instert my program name it does not compile.
{$code appl,tImr,code,160} //required by iziBasic program ppcall160;
It compiles when written like this, but when I change the program name to my program name it does not compile.
When I change ppcall160 to Timer.ibas it will not compile.
I have tried to print it, but there is nothing to print because it's empty.
It compiles with my creator ID, but not my program name. Could there be something with my program name that is not allowed in pp? |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 10 -------- le 06/08/2008 @ 12:04 par aldweb
visiteur |
Hello Gary and JoeV,
Gary, make sure that you compile first your iziBasic source code, then the PP applet. The PP applet will be added to the PRC generated by iziBasic. If you proceed the other way, iziBasic's compilation will delete the PP applet code resource.
You may also compile the PP applet separately, then add the generated code resource to your iziBasic resource file (using Bird). Then, compiling the iziBasic project will be enough. This is the easy way of proceeding once your PP applet is finalized.
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 11 -------- le 07/08/2008 @ 01:35 par Gary
visiteur |
Thanks Aldweb, you will not believe this, but last night while I tried to sleep and having no luck because of my code problems I had the same ideal. However, I forgot about it and did not try anything until I opened up this thread. Then I tried it and it worked
Could recomend a good place to learn pp code and applet's? I have been looking over the pp code and it's not much harder than izibasic, but I don't know anything about API calls and how to convert from C to pp. I have ordered a couple of books on Pascal, a beginners guide and Turbo Pascal. I've been looking through the beginners guide, but I did not get the Turbo Pascal yet.
What is the difference betweem Build and Make when I compile a pp applet? |
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|
|