Page 1 of 1

requester that times out, showing coutndown

Posted: Fri Jun 14, 2013 9:06 pm
by javierdlr
Hi, just trying to add a requester that timesout:

Code: Select all

..
requester = IIntuition->NewObject(NULL, "requester.class",
REQ_TitleText, VERS" ("DATE")",
REQ_BodyText, reqtext,
REQ_GadgetText, GetString(&li, MSG_REQ_ABORT_BUTTON),
REQ_TimeOutSecs, reqtout,
TAG_DONE);
answer = IIntuition->IDoMethod(requester, RM_OPENREQ, NULL, NULL, NULL);
IIntuition->DisposeObject(requester);
if(answer == 0) // user ABORTed reboot/poweroff 'LAST CHANCE', end properly
..
reqtext string is:
\033cSystem will %s in \033b%d\033n seconds.\nPlease wait!!!

It shows the time (reqtout) the user defined, but is it posible that such number/countdown is visible (real time) in the requester?

TIA

Re: requester that times out, showing coutndown

Posted: Sat Jun 15, 2013 2:14 am
by tonyw
I think you would have to change the timeout to 1 second. Then have a loop that counts down the timeouts, redrawing the text after each timeout and finally exiting when the counter gets to zero.

Re: requester that times out, showing coutndown

Posted: Sat Jun 15, 2013 12:02 pm
by javierdlr
tonyw wrote:I think you would have to change the timeout to 1 second. Then have a loop that counts down the timeouts, redrawing the text after each timeout and finally exiting when the counter gets to zero.
Yep, that's sort of what I was thinking. Just asked here if there is a "better" solution. TIA

Re: requester that times out, showing coutndown

Posted: Mon Jun 17, 2013 8:11 pm
by javierdlr
tonyw wrote:I think you would have to change the timeout to 1 second. Then have a loop that counts down the timeouts, redrawing the text after each timeout and finally exiting when the counter gets to zero.
How do I only (re)render/update the text contests without (re)opening the requester? http://www.os4coding.net/project/poff

On my final version I changed from a requester to a ReAction window and a fuelgauge, shows nice.

TIA

Re: requester that times out, showing coutndown

Posted: Tue Jun 18, 2013 1:40 am
by tonyw
I guess you could try a SetGadgetAttrs() on the Requester Object, but it's a hack and I'm not sure it would work.

Otherwise you could simply open a new requester (over the top of the old one that has timed out), then close the old one behind it...

I think your fuelgauge solution is the best.

Re: requester that times out, showing coutndown

Posted: Tue Jun 18, 2013 9:37 am
by salass00
tonyw wrote:I guess you could try a SetGadgetAttrs() on the Requester Object, but it's a hack and I'm not sure it would work.
That should be SetAttrs() since it's not a gadget and doesn't need a GadgetInfo for rendering. Anyway I doubt that this would work.

A possible future enhancement to requester.class would be to allow it with a tag to update a vararg with the countdown so that it could easily be inserted into f.e. the body text of the requester.

Re: requester that times out, showing coutndown

Posted: Tue Jun 18, 2013 2:09 pm
by javierdlr
tonyw wrote:I guess you could try a SetGadgetAttrs() on the Requester Object, but it's a hack and I'm not sure it would work.

Otherwise you could simply open a new requester (over the top of the old one that has timed out), then close the old one behind it...

I think your fuelgauge solution is the best.
I did try that, but you can see requester is flickering (open/close) and doesn't show "professional".
Changed to the fuelgauge and is more code(mess), but result is better.
TIA

Re: requester that times out, showing coutndown

Posted: Tue Jun 18, 2013 2:19 pm
by javierdlr
salass00 wrote:
tonyw wrote:I guess you could try a SetGadgetAttrs() on the Requester Object, but it's a hack and I'm not sure it would work.
That should be SetAttrs() since it's not a gadget and doesn't need a GadgetInfo for rendering. Anyway I doubt that this would work.

A possible future enhancement to requester.class would be to allow it with a tag to update a vararg with the countdown so that it could easily be inserted into f.e. the body text of the requester.

OK, will fill an enhancement bz entry ASAP. THX.