requester that times out, showing coutndown

This forum is for general developer support questions.
Post Reply
User avatar
javierdlr
Beta Tester
Beta Tester
Posts: 389
Joined: Sun Jun 19, 2011 11:13 pm
Location: Donostia (GUIPUZCOA) - Spain
Contact:

requester that times out, showing coutndown

Post 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
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1483
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: requester that times out, showing coutndown

Post 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.
cheers
tony
User avatar
javierdlr
Beta Tester
Beta Tester
Posts: 389
Joined: Sun Jun 19, 2011 11:13 pm
Location: Donostia (GUIPUZCOA) - Spain
Contact:

Re: requester that times out, showing coutndown

Post 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
User avatar
javierdlr
Beta Tester
Beta Tester
Posts: 389
Joined: Sun Jun 19, 2011 11:13 pm
Location: Donostia (GUIPUZCOA) - Spain
Contact:

Re: requester that times out, showing coutndown

Post 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
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1483
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: requester that times out, showing coutndown

Post 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.
cheers
tony
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: requester that times out, showing coutndown

Post 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.
User avatar
javierdlr
Beta Tester
Beta Tester
Posts: 389
Joined: Sun Jun 19, 2011 11:13 pm
Location: Donostia (GUIPUZCOA) - Spain
Contact:

Re: requester that times out, showing coutndown

Post 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
User avatar
javierdlr
Beta Tester
Beta Tester
Posts: 389
Joined: Sun Jun 19, 2011 11:13 pm
Location: Donostia (GUIPUZCOA) - Spain
Contact:

Re: requester that times out, showing coutndown

Post 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.
Post Reply